当前位置:Gxlcms > 数据库问题 > Ubuntu18.04安装MySQL

Ubuntu18.04安装MySQL

时间:2021-07-01 10:21:17 帮助过:32人阅读

目的:主力机目前使用的系统是Ubuntu18.04桌面系统,记录下MySQL的安装过程。

MySQL的删除

sudo apt purge mysql-*
sudo rm -rf /etc/mysql/ /var/lib/mysql
sudo apt autoremove
sudo apt autoclean

MySQL安装

# 1、更新apt包索引
sudo apt update
# 2、安装默认安装包
sudo apt install mysql-server
# 3、运行安全脚本,做一些配置
sudo mysql_secure_installation

技术图片
补充说明:安装完后root用户无法登录,故创建root用户

MySQL安装完建root用户

Ubuntu18.04安装 MySQL不会弹出设置账号密码的框,会自己默认设置好账号密码,配置文件在/etc/mysql/debian.cnf
技术图片
使用此账号登录创建root用户
技术图片

-- 更新root用户
update mysql.user set authentication_string=password("123456") where user="root";
-- 消除警告
update mysql.user set plugin="mysql_native_password";
-- 更新权限
flush privileges;

参考

https://www.jianshu.com/p/4b691bbe40a3
https://baijiahao.baidu.com/s?id=1626805903141392082&wfr=spider&for=pc
https://www.jianshu.com/p/ca22263ce97f

Ubuntu18.04安装MySQL

标签:安装 mysql   str   账号密码   无法登录   ring   set   设置   mic   补充   

人气教程排行