Home >Database >Mysql Tutorial >How to configure mysql8.0 in ubuntu20.04
wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
dpkg -i mysql-apt-config_0.8.22-1_all.deb
Selection items will appear during the installation process. Use the up and down keys to select OK to continue the installation
Update apt software source
apt-get update
Install MySQL Server
apt-get install mysql-server
# 查看服务状态 service mysql status # 停止服务 service mysql stop # 启动服务 service mysql start # 重启服务 service mysql restart #端口查看 netstat -anp | grep mysql
netstat -an|grep 3306
cd etc/mysql/mysql.conf.d #打开配置文件 sudo vim mysqld.cnf
Delete port = 3306 comment
Comment bind-address = 127.0.0.1
# 根据提示进行输入,问Y/N时不会就y吧 mysql_secure_installation
# 进入mysql服务台 如果要输密码直接回车即可 mysql -h 127.0.0.1 -u root -p #选择mysql数据表 use mysql; # 更改root用户的访问权限 update user set host='%' where user='root'; #开放root用户所有权限 grant all privileges on *.* to 'root'@'%' identified by '你的root账户密码'; #展示user表的两个字段 select host,user from user;
Ps: Don’t forget to release the firewall of the cloud host
The above is the detailed content of How to configure mysql8.0 in ubuntu20.04. For more information, please follow other related articles on the PHP Chinese website!