centos7只包含了mariadb的安装源

我们需要到官方下载社区版:https://dev.mysql.com/downloads/

centos7下mysql安装

centos7下mysql安装

下载安装包并上传到服务器

centos7下mysql安装

安装出现错误

centos7下mysql安装

这个是系统自带的Mariadb的依赖包有影响需要移除:yum -y remove mariadb-libs

再次安装MYSQL,[root@centos7 ~]# yum -y install mysql-community-*.rpm

提示安装成功。

设置开机启动启动:[root@centos7 ~]# systemctl enable --now mysqld

mysql数据库文件存储的路径:[root@centos7 ~]# ls /var/lib/mysql

查看mysql运行状态:[root@centos7 ~]# systemctl status mysqld

安装成功后在下面目录会显示MYSQL的初始密码:[root@centos7 ~]# cat /var/log/mysqld.log |grep password

centos7下mysql安装

登陆mysql密码需要加引号因为有特殊字符: [root@centos7 ~]# mysql -uroot -p'd0afI3r2ao=q'

使用命令修改密码:

[root@centos7 ~]# mysqladmin -uroot -p'd0afI3r2ao=q' password 'Clyg@1234';

centos7下mysql安装

密码修改成功

相关文章:

  • 2021-11-15
  • 2021-10-21
  • 2021-10-01
  • 2021-12-12
  • 2021-06-16
  • 2021-09-29
猜你喜欢
  • 2021-11-20
  • 2021-12-18
  • 2021-07-23
  • 2022-12-23
相关资源
相似解决方案