Maria DB / MYSQL

https://www.cyberciti.biz/faq/how-to-show-list-users-in-a-mysql-mariadb-database/

Login to mysqlas root using your root pass:
# mysql -u root -p

To list all the users:
mysql> SELECT User FROM mysql.user;

Show host permissions - where the users are allowed to logon from:
mysql> SELECT host, user FROM mysql.user;

Show users permissions:
mysql> SELECT User, Db, Host from mysql.db;

Show permissions of specific user:
mysql> show grants for 'root'@'%';
mysql> show grants for 'root'@'192.168.1.80';
mysql> show grants for 'root'@'localhost';

Change user host permissions:
UPDATE mysql.user SET Host='%' WHERE Host='localhost' AND User='username';
FLUSH PRIVILEGES;

Change user password:
UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='root';


To create new user:
CREATE USER 'superuser'@'localhost' IDENTIFIED BY 'new_pass';

And give access to do everything
GRANT ALL PRIVILEGES ON *.* TO 'superuser'@'localhost' WITH GRANT OPTION;

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

4 × 1 =