Ubuntu 18.04 安装 MySQL

Ubuntu 设置清华源:https://mirrors.tuna.tsinghua...
注意:Ubuntu 18.04 默认安装的是 mysql5。
参考资料 (重点)https://blog.csdn.net/BobYuan...
https://blog.csdn.net/weixin_...
https://www.jianshu.com/p/f0d...
【Ubuntu 18.04 安装 MySQL】https://segmentfault.com/a/11...
安装好以后执行的操作

mysql 直接进入客户端# 这是本地 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; FLUSH PRIVILEGES; create user 'root'@'%' identified by '123456'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; use mysql select host,user,authentication_string from user; exit

停止 MySQL 服务
sudo systemctl stop mysql

修改 MySQL 的配置文件
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

启动 MySQL 服务
sudo service mysql start

# 非必须操作 sudo apt update # 非必须操作 sudo apt upgrade # 下载速度过慢可以替换清华源 sudo apt install mysql-server mysql-client

    推荐阅读