ubuntu 18.04用apt安装mysql-server


mysql5.7安装完成后普通用户不能进mysql

原因:root的plugin被修改成了auth_socket,用密码登陆的plugin应该是mysql_native_password,直接用root权限登录就不用密码,修改root密码和登录验证方式。

#移除之前安装的mysql
sudo apt-get --purge remove mysql-server mysql-common mysql-client

#安装mysql-server
sudo apt-get install mysql-server mysql-common mysql-client

#更改mysql root账户认证模式
mysql
select user, plugin from mysql.user;
update mysql.user set authentication_string=PASSWORD('密码'), plugin='mysql_native_password' where user='root';
flush privileges;
exit

#重启mysql-server
service mysql restart

#配置root远程登陆
grant all on *.* to root@'%' identified by '密码' with grant option;
flush privileges;
exit

#修改侦听地址127.0.0.1为0.0.0.0
vi /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM