centos8安装mysql5.7版本

这篇博客是对一个配置博客所遇问题的解决办法,
原博客链接:https://blog.csdn.net/qq_37598011/article/details/93489404?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1

问题1,./mysql -u root -p命令报错,信息如下
./mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
解决方法:

sudo yum install libncurses*

完美解决。

问题2,登陆时键入密码,使用enter键报错,信息如下:
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
解决方法:
修改配置文件跳过密码验证
vim /etc/my.cnf(注:windows下修改的是my.ini)
[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程
然后重启mysql

service mysql restart

接下来修改密码:

#首选选择一个数据库,不然会报错
use root;
update user set authentication_string=password('新密码') where user='root';
flush privileges;
quit;

问题3,登录后键入命令都会报如下错误
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决方法如下:

alter user user() identified by "新密码";

over!!!

你可能感兴趣的:(MySql)