Home > Database > Mysql Tutorial > body text

How to configure mysql8.0 in ubuntu20.04

WBOY
Release: 2023-06-03 12:48:05
forward
1894 people have browsed it

1 Installation

1.1 Download

wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
Copy after login

1.2 Installation

dpkg -i mysql-apt-config_0.8.22-1_all.deb
Copy after login

Selection items will appear during the installation process. Use the up and down keys to select OK to continue the installation

How to configure mysql8.0 in ubuntu20.04

1.3 Install MySQL Server

Update apt software source

apt-get update
Copy after login

Install MySQL Server

apt-get install mysql-server
Copy after login

1.4 Common commands

# 查看服务状态
service mysql status
# 停止服务
service mysql stop
# 启动服务
service mysql start
# 重启服务
service mysql restart
#端口查看
netstat -anp | grep mysql
Copy after login

2 Configure external network access

2.1 View port

netstat -an|grep 3306
Copy after login

How to configure mysql8.0 in ubuntu20.04

2.2 Modify configuration file

cd etc/mysql/mysql.conf.d
#打开配置文件
sudo vim mysqld.cnf
Copy after login

Delete port = 3306 comment

How to configure mysql8.0 in ubuntu20.04

Comment bind-address = 127.0.0.1

How to configure mysql8.0 in ubuntu20.04

2.3 Modify root password

# 根据提示进行输入,问Y/N时不会就y吧
mysql_secure_installation
Copy after login

2.4 Modify user

# 进入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;
Copy after login

How to configure mysql8.0 in ubuntu20.04

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template