Mysql二进制包:? mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
rpm -qa|grep mysql
rpm -qa|grep mariadb
rpm -e XXX.rpm --nodeps # 强制卸载rpm包
rm -rf /etc/my.cnf
rm -rf /etc/mysql
rm -rf /usr/local/mysql
yum -y install libaio
yum -y install libnuma
yum -y install libncurses.so.5
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
/etc/my.cnf
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/opt/mysql
datadir=/opt/mysql/data
socket=/opt/mysql/data/mysql.sock
log-error=/opt/mysql/data/mysql.err
pid-file=/opt/mysql/data//mysql.pid
character_set_server=utf8mb4
collation_server=utf8mb4_bin
[client]
port=3306
socket=/opt/mysql/data/mysql.sock
default-character-set=utf8mb4
cd /opt
tar -zxvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.26-linux-glibc2.12-x86_64 mysql
mkdir -p /opt/mysql/data
chown -R mysql:mysql /opt/mysql
cd /opt/mysql
bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql
cp support-files/mysql.server /etc/init.d/mysql
# 配置环境变量, /etc/profile
export PATH=$PATH:/opt/mysql/bin
# 启动数据库
service mysql start
ps -ef|grep mysql
/opt/mysql/bin/mysql -u root -p
root初始密码在:/opt/mysql/data/mysql/mysql.err
# 修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
# 查看字符集
show variables like 'chara%';
show variables like 'collation%';
# 查看数据库
show databases;
# 建库
create database test;
# 删库
drop database test;