在centos的库中mysql已经被mariadb数据库替代,如果想继续在centos上安装mysql就需要自己下载安装包
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
运行成功后重启mysql服务。
service mysqld restart 或者 /etc/init.d/mysqld restart
初始安装的mysql的root用户是没有密码的,配置root密码
# mysql -uroot
mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
mysql> exit
时间: 2024-10-02 03:14:18