使用root登陆mariadb出错
mysql -uroot -pxxxx
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
解决方法:
#进入数据库
mysql
#查看有哪些数据库
show databases;
#使用mysql库
use mysql;
#查看root状态
SELECT user, password FROM user WHERE User = 'root';
返回invalid,原因
Still, some users may wish to log in as MariaDB root without using sudo. Hence the old authentication method — conventional MariaDB password — is still available. By default it is disabled (“invalid” is not a valid password hash), but one can set the password with a usual
SET PASSWORD
statement. And still retain the password-less access via sudo.
解决方案
SET PASSWORD FOR 'root'@localhost = PASSWORD("myReallyStrongPwd");
在测试root登陆就OK了