安装MySQL

$ sudo apt update
$ sudo apt install mysql-server

进行初始化配置
$ sudo mysql_secure_installation

查看MySQL版本
$ mysql --version

查看MySQL运行状态
systemctl status mysql.service

进行连接
$ sudo mysql -u root -p
Ubuntu安装MySQL8.0

远程连接配置

  1. $ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
    打开文件注释掉bind-address=127.0.0.1
    Ubuntu安装MySQL8.0

  2. 重启MySQL服务
    $ sudo /etc/init.d/mysql restart
    $ sudo systemctl restart mysql.service

  3. 连接MySQL
    $ sudo mysql -u root -p

  4. 创建远程连接账户并授权
    mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456';
    mysql> grant all privileges on *.* to 'root'@'%';

  5. 如果远程连接时报错plugin caching_sha2_password could not be loaded,执行
    mysql> alter user 'root'@'%' identified with mysql_native_password by '123456';

  6. 查看用户
    mysql> select host, user, authentication_string, plugin from user;
    Ubuntu安装MySQL8.0

  7. 使用Navicat远程连接
    Ubuntu安装MySQL8.0

相关文章:

  • 2021-11-12
  • 2021-05-18
  • 2021-04-27
  • 2021-11-18
  • 2021-11-08
  • 2021-05-26
  • 2021-12-18
  • 2021-08-31
猜你喜欢
  • 2021-06-11
  • 2021-10-07
  • 2021-10-10
  • 2021-11-21
  • 2021-10-26
  • 2018-07-08
相关资源
相似解决方案