1.下载MySQL
linux通用版
https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
解压
2.配置
按照别人方法配置文件
[client]
port=3336
socket=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/mysql.sock
[mysqld]
port=3336
basedir=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64
datadir=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/data
pid-file=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/mysql.pid
socket=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/mysql.sock
log_error=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/error.log
server-id=100
报错缺少库
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决
apt-get install libaio1
安装
./bin/mysqld --defaults-file=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/my.cnf --initialize --user=chenyw --basedir=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64 --datadir=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/data
启动mysql
./bin/mysqld_safe --defaults-file=/mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/my.cnf -user=chenyw &
登录mysql
./bin/mysql -u root -p -S /mnt/sdb/chenyw/software/mysql-5.7.21-linux-glibc2.12-x86_64/mysql.sock
修改root密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');