MySQL 安装

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');
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容