1下载官方gz安装包
2解压
3移动目录 mv mysql-8.0.27-linux-glibc2.12-x86_64 /usr/local/mysql
4创建用户 useradd -s /sbin/nologin -M mysql
5初始化mysql ./mysqld --initialize --user=mysql
6记下密码
7连接到开机启动
cp ../support-files/mysql.server /etc/init.d/mysqld
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
8安装系统库 libtinfo.so.5 yum install libncurses*
9启动mysql service mysqld start
10登录 ./mysql -uroot -p
11修改密码 alter user 'root'@'localhost' identified by 'password';
12开启远程连接
mysql>use mysql;
msyql>update user set user.Host='%' where user.User='root';
mysql>flush privileges;