Linux Ubuntu 20.0.4 安装MySQL 8

Linux Ubuntu 20.0.4 安装MySQL 8
MySQL 安装
apt install mysql-server mysql-client.
配置文件默认在
/etc/mysql/mysql.conf.d/mysqld.cnf

MySQL 设置密码
登录MySQL执行
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY

设置远程访问:
首先试一试本地连接,表示mysql可以连接的
netstat -apn|grep 3306,如果显示的是 127.0.0.1:3306,注释 /etc/mysql/mysql.conf.d/mysqld.cnf 中的 bind-adress 127.0.0.1,然后 service mysql restart 重启msyql,再次 netstat -apn|grep 3306,如果显示的是:::3306就可以了
修改可以远程登录的权限(本地登录mysql)

  1. create user root@’%’ identified by ‘123456’;
  2. grant all privileges on . to root@’%’ with grant option;
  3. flush PRIVILEGES;

猜你喜欢

转载自blog.csdn.net/weixin_43485737/article/details/120893926