rpm -qa|grep mysq
rpm -qa|grep mariadb
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
ll -tr
mkdir /usr/local/mysql
cd /usr/local/
ll -tr
tar -xzvf /root/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.13-linux-glibc2.5-x86_64 mysql
mkdir /data/mysql
groupadd mysql
useradd -r -g mysql mysql
chown mysql:mysql -R /data/mysql
vim /etc/my.cnf (添加线内内容)
-----------------------------------------------------------------
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/data/mysql
socket=/tmp/mysql.sock
log-error=/data/mysql/mysql.err
pid-file=/data/mysql/mysql.pid
#character config
character_set_server=utf8mb4
symbolic-links=0
explicit_defaults_for_timestamp=true
-----------------------------------------------------------------
cd /usr/local/mysql/mysql-5.7.13-linux-glibc2.5-x86_64/bin/
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/mysql-5.7.13-linux-glibc2.5-x86_64 --datadir=/data/mysql/ --user=mysql --initialize
--------------------------------------
错误提示:./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
rpm -qa|grep libaio
yum install libaio-devel.x86_64
------------------------------------------
cat /data/mysql/mysql.err(查看初始化密码)
service mysql start
cp /usr/local/mysql/mysql-5.7.13-linux-glibc2.5-x86_64/support-files/mysql.server /etc/init.d/mysql
service mysql start
./mysql -u root -p
修改密码
SET PASSWORD = PASSWORD('1qaz6ujn@');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;如果不能外部连接修改以下内容
use mysql
update user set host = '%' where user = 'root';
FLUSH PRIVILEGES;