Ubuntu18.04 安装Mysql时未让输入密码

时间:2018/5/12

修改时间: 2019/02/19

 


 

在ubuntu18.04中使用

apt install mysql-server

 安装数据库时,在安装过程中,并没有像ubuntu16中提示输入root用户的密码;

虽然可以在 /etc/mysql/debian.cnf(?) 文件中找到 用户名和密码 https://blog.csdn.net/sinat_21302587/article/details/76870457 ,却只能使用root用户登陆mysql。

 修改时间 2019/02/19

sudo mysql   进入mysql

执行命令:

update mysql.user set authentication_string=PASSWORD('123456'),plugin='mysql_native_password' where user='root';

flush privileges;

exit;

然后就可以使用普通用户登录。(测试于mysql-5.7,ubuntu18)


 或者

解决办法:

下载 https://dev.mysql.com/downloads/repo/apt/ 中的deb包。

dpke -i deb_name

根据需求选择配置。

然后

apt update 
apt install mysql-server

此时的安装过程就会提示输入root密码,安装完成后普通用户也能直接登陆。

 

posted @ 2018-05-12 22:27  生生之谓易  阅读(3243)  评论(0)    收藏  举报