yum list mysql #搜索mysql安装包和
sudo yum -y install mysql #参数-y为不需要提示安装
/usr/bin/mysqld_safe
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/libexec/mysql55/mysqladmin -u root password 'new-password'
sudo mysqld_safe --user=root &
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock
sudo service mysqld status #查看mysqlserver服务状态,已启动为is running…
sudo yum -y install php-mysql #安装php-mysql 扩展
sudo service php-fpm restart #重启php-fpm服务进程
<?php
@mysqli_connect("localhost","root","password","mysql") or die("connect mysql failed\n");
echo "connect ok\n";
?>