下载压缩包
使用xftp上传到/usr/local目录下
解压–删除–重命名
tar -xvf mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz rm -rf mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz mv mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz/ mysql
groupadd mysql useradd -r -g mysql mysql groups mysql
[root@freely local]# cd mysql/ [root@freely mysql]# chown -R mysql:mysql ./
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
注意记下临时生成的数据库密码,我这里为’&k0m=inJgNC.’
7. 启动mysql
./support-files/mysql.server start
ln -s /usr/local/mysql/bin/mysql /usr/bin mysql -uroot -h 127.0.0.1 -p
mysql> set password = password('123456');
此时已安装完毕,若使用navicat连接再执行以下操作:
mysql> update user set host='%' where user='root'; mysql> flush privileges; mysql> exit;
firewall-cmd –add-port=3306/tcp –permanent firewall-cmd –reload