码迷,mamicode.com
首页 > 数据库 > 详细

ubuntu 18.04用apt安装mysql-server

时间:2018-10-30 14:53:53      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:com   远程登陆   127.0.0.1   native   5.7   权限   rom   word   mysqld   

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

ubuntu 18.04用apt安装mysql-server

标签:com   远程登陆   127.0.0.1   native   5.7   权限   rom   word   mysqld   

原文地址:https://www.cnblogs.com/ddif/p/9876502.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!