Mysql configuration remote access in Ubuntu

Mysql configuration remote access in Ubuntu

1. Install mysql 8.0.27 directly

sudo apt install mysql-server -y

2. View the file location and database location of mysql

sudo mysql
select @@basedir,@@datadir;

3. Install tools

sudo apt install net-tools -y

4. Check whether the port number is released

netstat -ano|grep 3306

5. Edit the file

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
注释以下两句
#bind-address           = 127.0.0.1
#mysqlx-bind-address    = 127.0.0.1

6. Create account and password

sudo mysql
mysql> create user admin identified by 'admin123';

7. Give the highest authority to manage all databases

mysql> grant all on *.* to admin;

8. Restart the mysql service

sudo systemctl restart mysql
sudo systemctl status mysql

9. Use the database remote operation software to connect

Guess you like

Origin blog.csdn.net/weixin_42436236/article/details/122269297