1.官⽹下载mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar,解压到  /usr/local/mysql/  ⽬录下;
2.依次安装mysql组件:
# rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm
# rpm -ivh mysql-community-libs-8.0.15-1.el7.x86_64.rpm
# rpm -ivh mysql-community-libs-compat-8.0.15-1.el7.x86_64.rpm
# rpm -ivh mysql-community-client-8.0.15-1.el7.x86_64.rpm
# rpm -ivh mysql-community-server-8.0.15-1.el7.x86_64.rpm
如果有报错如:
依赖检测失败:
mysql-community-common(x86-64) >= 5.7.9 被 mysql-community-libs-5.7.19-1.el7.x86_64 需要mariadb-libs 被 mysql-community-libs-5.7.19-1.el7.x86_64 取代
则表⽰该依赖已存在,则删除以前依赖,重新安装,删除命令为:
# rpm -e mariadb-libs
若还有报错:
错误:依赖检测失败:
libmysqlclient.so.18()(64bit) 被 (已安裝) postfix-2:2.10.1-7.el7.x86_64 需要
libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) postfix-2:2.10.1-7.el7.x86_64 需要
删除所有rpm包:
# rpm -qa |grep -i mysql
重新安装上述rpm包。
3.启动服务:
# systemctl start mysqld.service
查看状态:
# systemctl status mysqld.service
4.修改密码:
  5.7版本以后,安装mysql后默认⽣成密码,密码在/var/log/mysqld.log⽂件中,
  命令搜索:#grep 'temporary password'  mysqld.log
  然后登陆:#mysql -uroot -p
  输⼊密码后,进⼊mysql,修改密码:
    mysql> use mysql;
    mysql> update user 'root'@'%'  identified by 'password_123';
    mysql> exit;
4.navicat连接测试:
  正确输⼊连接信息后,可能会出现⼀下问题:
  (1)error 1130-host ‘192.168.*.*’ is not allowed to connect to this MySql server.
    解决:该mysql服务不允许远程连接。进⼊mysql
    mysql> use mysql;
    mysql> alter user set host='%' where user = 'root';
    mysql>select host,user from user;
    mysql>flush privileges;
    mysql>exit;
  (2)error 1251 client does not support authentication protocol requested by server.
    解决:root账户默认的加密⽅式是caching_sha2_password;很多客户端⼯具不⽀持这种加密认证⽅式,连接的时候就会报这种错。
    mysql> use mysql;
    mysql> alter user 'root'@'%' identified by 'password_123' password expire never;
    mysql> alter user 'root'@'%' identified with mysql_native_password by 'password_123';
    mysql> flush privileges;
    mysql> exit;mysql下载libs包的网址
    重启mysql服务,再次连接,成功。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。