原创

Mysql8.0在Centos7安装

下载

mysql历史版本下载:https://downloads.mysql.com/archives/

下载8.0.11

wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar

安装教程

https://blog.csdn.net/qq_29485643/article/details/82020257

https://blog.csdn.net/vkingnew/article/details/81267223

配置

初始化数据库:

/db/mysql/bin/mysqld --user=mysql --basedir=/db/mysql --datadir=/db/mysql/data --initialize

A temporary password is generated for root@localhost: W%JF.9uh6JUP

设置启动文件和环境变量:

cp support-files/mysql.server /etc/init.d/mysqld

export PATH=/db/mysql/bin:/db/mysql/lib:$PATH

启动mysql

/etc/init.d/mysqld start

修改root密码

mysqladmin -u root -p老密码 password 新密码

mysql -uroot -p

ALTER user 'root'@'localhost' IDENTIFIED BY 'Leisure$2018';

修改密码时设置加密方式方便远程登录:

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;

FLUSH PRIVILEGES;

配置root可远程访问

update user set host = "%" where user='root';

创建新数据库

create database leisureCar default character set utf8 collate utf8_general_ci;;

创建对应数据库可远程登录的用户

create user leisure@'%' identified WITH mysql_native_password by 'Leisure$9527';

grant all privileges on leisureCar.* to leisure@'%' with grant option;

FLUSH PRIVILEGES;

问题

  • mysql初始化出现:Installing MySQL system tables.../usr/local/mysql/bin/mysqld: error while loading shared

https://blog.csdn.net/songmao3145/article/details/77676402

解决方法:yum install libaio* -y

  • 启动Mysql出错,查看日志老是找到/usr/local下的mysql

解决方法:修改启动脚本support-files/mysql.server

指定basedir和datadir

https://blog.csdn.net/yi247630676/article/details/80352655

  • 解决Navicat for MySQL 连接 Mysql 8.0.11 出现1251- Client does not support authentication protocol 错误

https://blog.csdn.net/yy763496668/article/details/80208930

  • 配置默认的数据库编码和排序规则

https://blog.csdn.net/IndexMan/article/details/80385698

正文到此结束