下载地址:https://dev.mysql.com/downloads/mysql/
根据系统选择bundle包下载
![image.png](https://img-blog.csdnimg.cn/img_convert/0e36dc71afbf845b2579e3a1016636ce.png#clientId=ud2b3cb8b-5e7c-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=1052&id=uf3bc7a7c&margin=[object Object]&name=image.png&originHeight=1578&originWidth=1627&originalType=binary&ratio=1&rotation=0&showTitle=false&size=355712&status=done&style=none&taskId=ubc0168e7-ccdb-4353-a9b7-967b748ebd2&title=&width=1084.6666666666667)
tar -xf mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
![image.png](https://img-blog.csdnimg.cn/img_convert/f486c8cb42ff408ffc59f507eb5d1ca8.png#clientId=ud2b3cb8b-5e7c-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=u52367123&margin=[object Object]&name=image.png&originHeight=467&originWidth=725&originalType=url&ratio=1&rotation=0&showTitle=false&size=55798&status=done&style=none&taskId=u0364f2d1-d193-45d2-9df3-d0866bf957d&title=)
3. 安装mysql 3.1 按照依赖关系依次安装rpm包 依赖关系依次为common→libs→client→serverrpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm # ivh中, i-install安装;v-verbose进度条;h-hash哈希校验3.2 libaio.so包缺失处理
安装过程中出现异常,提示缺少libaio包
[root@AppServer1 soft]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: libaio.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64 libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64 libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
到Centos官网下载后rpm安装: http://mirror.centos.org/centos/7/os/x86_64/Packages/
![image.png](https://img-blog.csdnimg.cn/img_convert/32935996309afff4ac08c7570c0bbe0c.png#clientId=u06e70408-a0c6-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=751&id=uf4e33b94&margin=[object Object]&name=image.png&originHeight=1126&originWidth=2059&originalType=binary&ratio=1&rotation=0&showTitle=false&size=143877&status=done&style=none&taskId=u97b4ab87-0e34-4b6a-b264-186a442c94b&title=&width=1372.6666666666667)
数据库目录:/var/lib/mysql/
命令配置:/usr/share/mysql (mysql.server命令及配置文件)
相关命令:/usr/bin (mysqladmin mysqldump等命令)
启动脚本:/etc/rc.d/init.d/ (启动脚本文件mysql的目录)
系统配置:/etc/my.conf
systemctl status mysqld systemctl restart mysqld3.5 密码设置
1. vim /etc/my.cnf 2. 在最后加上: skip-grant-tables 3. 重启mysql服务: systemctl restart mysqld 4. mysql -u root-p 不需要输入密码直接enter即可 5. 设置root账号的密码: 设置密码:update mysql.user set authentication_string=password('123456') where user='root' ; 刷新:FLUSH PRIVILEGES; 6. 退出mysql:将之前加入的跳过密码验证删掉 命令:vim /etc/my.cnf 把skip-grant-tables去掉 7. 重新登录数据库 执行命令出现不能操作情况:show databases; 修改密码即可:alter user 'root'@'localhost' identified by 'Root123456xxx'; 8. 外部不能连接问题 use mysql ; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Root123456xxx' WITH GRANT OPTION; flush privileges;刷新
[
](https://blog.csdn.net/xixiyuguang/article/details/106658129)