config

max_connections = 100

SHOW STATUS LIKE 'Max_used_connections'

SHOW STATUS LIKE 'Threads_connected';
/etc/mysql/my.cnf
/etc/mysql/mysql.conf.d/mysqld.cnf

connect if no root user

1. etc\mysql\mysql.conf.d\mysqld.cnf -> [mysqld] -> add line:
   skip-grant-tables
2. systemctl restart mysql
3. run: mysql
4. mysql run: FLUSH PRIVILEGES;
5. create user 'root'@'localhost';
6. grant all on *.* to 'root'@'localhost'
7. update user set `plugin` = 'auth_socket' where `user` = 'root';
8. mysqld.cnf -> remove skip-grant-tables
9. systemctl restart mysql
10 run: mysql
11. mysql run: SELECT CURRENT_USER();



https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html#resetting-permissions-unix

 

show-create-grant-databases

Login
1. mysql -u myusername -p OR mysql (root user)
2. enter password
3. mysql> SHOW DATABASES;

Create&Drop database
1. mysql> CREATE DATABASE database_name;
1.1. mysql> CREATE DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;
2. mysql> DROP DATABASE database_name;

Show grants
1. mysql> SHOW GRANTS;
1. mysql> SHOW GRANTS username;
Grant database - from root user
1. mysql> GRANT ALL PRIVILEGES ON db_name.* TO 'username'@'localhost';

ALL PRIVILEGES: CREATE, DELETE DB etc
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';

p.s. always write ; at the end
https://linuxize.com/post/how-to-show-databases-in-mysql/
https://www.mysqltutorial.org/mysql-create-database/