mkdir /opt/Mysql
cd /opt/Mysql
wget /archives/mysql-8.0/mysql-8.0.26-linux-glibc2.12-x86_64.
tar -xvf mysql-8.0.26-linux-glibc2.12-x86_64.
mkdir /usr/local/mysql
mv mysql-8.0.26-linux-glibc2.12-x86_64/* /usr/local/mysql
groupadd mysql
useradd mysql -g mysql
mkdir data
chown -R mysql data
cd /usr/local
chown -R mysql
cd mysql
yum -y install libaio-devel.x86_64
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/opt/Mysql/data
复制自动生成的密码root@localhost:xxxxxxxxxxxx
vim /etc/
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/Mysql/data
socket = /usr/local/mysql/
character-set-server=utf8
bind-address = 10.0.20.3
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
socket = /usr/local/mysql/
default-character-set=utf8
vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib #mysql安装目录
export PATH
wq
source /etc/profile
测试mysql
support-files/ --help
support-files/ start
support-files/ status
mysql -u root -pxxxxxxxxxxxx #粘贴密码
--------
遇到错误:mysql: error while loading shared libraries: .5: cannot open shared ....
执行:dnf install ncurses-compat-libs
--------
alter user 'root'@'localhost' identified by 'password'; # 修改密码
use mysql;
select host, user, authentication_string, plugin from user;#查看用户信息
exit;
support-files/ stop
support-files/ status
设置开机自启动
cp support-files/ /etc//mysqld
chmod +x /etc//mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
chkconfig --list mysqld
设置远程登录
systemctl status mysql
systemctl start mysql
mysql -u root -p
use mysql;
update user set host='%' where user ='root';
select user,host from user;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
exit;
service mysql restart
firewall-cmd --state
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
netstat -nplt