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)
答案 0 :(得分:0)
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;