Колян Трухин Колян Трухин - 4 years ago 237
Linux Question

Mysql (MariaDB) acess denied after reboot

Arch Linux, Mariadb 10.1.21-1.
My commands:
yaourt -S mariadb
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl start mariadb
mysql_secure_installation
yes
yes
set root pass
password
yes
yes
mysql -u root -ppassword
CREATE DATABASE db;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON db.* TO 'username'@'localhost';
quit;
mysql -u username -ppassword
ALL OK!
quit;
sudo systemctl stop mariadb;
sudo shutdown -r now;
...
sudo systemctl start mariadb;
mysql -u coolone -ppassword;
ERROR 1045 (28000): Access denied for user 'coolone'@'localhost' (using password: YES)

Answer Source
mysql -u root -ppassword
    CREATE DATABASE db;
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON db.* TO 'username'@'localhost';
    FLUSH PRIVILEGES;
quit;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download