安装命令:yum -y install mysql-server(不是yum install mysql)
输入“mysql”,可能会出现错误:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
原因:mysql服务没有启动。、
输入“service mysqld start”,可能出现错误:mysqld: unrecognized service
原因:yum命令并没有把 mysql装入 service
输入:chkconfig mysqld on 将mysql加入service。
所以,标准的命令流应该是:
(1)yum -y install mysql-server
(2)chkconfig mysqld on
(3)service mysqld start
(4)mysql
安装并启动完成后,还可能出现无法从远程链接到mysql数据库的情况:
(1)GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on <DBNAME>.* TO '<USERNAME>'@'localhost' IDENTIFIED BY '<PASSWORD>';