時間: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密碼,安裝完成后普通用戶也能直接登陸。