当前位置: 代码迷 >> 综合 >> Cent OS 8安装mysql8
  详细解决方案

Cent OS 8安装mysql8

热度:14   发布时间:2023-12-16 20:55:17.0

查看是否安装mysql

[admin@bogon ~]$ whereis mysql

如果当前系统已安装mysql就会展示mysql路径

[admin@bogon ~]$ whereis mysql
mysql:

查看当前yum库里的mysql

[admin@bogon ~]$ yum list mysql*

安装

[admin@bogon ~]$ yum install mysql-server.x86_64 

查看是否安装成功 

[admin@bogon ~]$ whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

查看是否开机自启

[admin@bogon ~]$ systemctl list-unit-files | grep mysqld
mysqld.service                             disabled 
mysqld@.service                            disabled 

设置mysql服务为开机自启

[admin@bogon ~]$ systemctl enable mysqld.service 
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.

查看是否开启

[admin@bogon ~]$ systemctl list-unit-files | grep mysqld
mysqld.service                             enabled  
mysqld@.service                            disabled 

 查看服务是否开启

[admin@bogon ~]$ ps -ef | grep mysql
admin      33205    2908  0 16:26 pts/1    00:00:00 grep --color=auto mysql

开启服务

[admin@bogon ~]$ systemctl start mysqld.service #启动服务