首先mysql.org下载mysql-8.xxxx-bundle.tar
mkdir mysql8
mv mysql8-..... /mysql8
tar xf mysql8-.xxxx.bundle.tar -C mysql8
安装
rpm -ih mysql-community-common-xxxx.rpm
yum remove mariadb-libs
(先卸载mariadb-libs不然下一步会报错)
rpm -ih mysql-community-libs-8.0-xxxx.rpm
rpm -ih mysql-community-libs-compat-xxxx.rpm
(兼容包,如不装在安装php-mysql的时候会报错)
rpm -ih mysql-community-client-xxxx.rpm
rpm -ih mysql-community-server-xxxx.rpm
rpm -ih mysql-community-devel-xxxx.rpm
启动并配置远程连接
可以使用
mysql_secure_installation
来更改密码
也可以
systemctl start mysqld
systemctl enable mysqld
vim /etc/my.cnf
增加
skip-grant-tables
:wq
systemctl restart mysqld
mysql -u root -p
use mysql
update user set authentication_string = ' ' where user = 'root';
flush privileges;
然后注释掉skip-grant-tables 重启mysqld 空密码登入mysql
alter user 'root'@'localhost' identified by 'xxxxxxxx';
flush privileges;
如果需要降低密码复杂度要求
set validate_password_policy=0;
set validate_password_length=1;
一个是减低复杂要求,一个是减少长度要求
重新用root登录创建远程专用账户并做远程登录配置
mysql8创建用户必须在创建时就用identified with 'mysql_native_password’设置好验证方式,不然再用update改host %和验证,最后 grant all privileges都会报错,
not allowed create user by grant,然后navicat一直连不上…不知道是bug还是mysql有意采用这样的机制…
create user 'dog'@'%' identified with 'mysql_native_password' by 'xxxxxxx';
select user,host,plugin from user;
~~update user set plugin = 'myslq_native_password' where user = 'dog';~~
grant all privileges on *.* to 'dog'@'%';
flush privileges;
防火墙开放3360端口 navicat就可以访问了
删除用户与一出权限
revoke all privileges on *.* to 'dog'@'%';
drop user 'dog'@'%';