centos7默认将mariadb视作mysql。
卸载mariadb才能安装mysql。
卸载mariadb的方法:
#列出所有被安装的rpm package
rpm -qa | grep mariadb
#逐个删除每一个列出来的文件,--nodeps强制删除
rpm -e --nodeps mariadb- libs-************.x86_64
官网下载安装mysql-server
wget
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
安装Apache, PHP, MySQL以及php连接mysql库组件。
yum -y install httpd php mysql mysql-server php-mysql
安装apache扩展
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
安装php的扩展
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
安装MySQL的扩展
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
配置开机启动服务
#/sbin/chkconfig httpd on [设置apache服务器httpd服务开机启动]
#/sbin/service httpd start [启动httpd服务,与开机启动无关]
#/sbin/service mysqld start [启动mysqld服务,与开机启动无关]
初次安装mysql是root账户是没有密码的
mysql -u root
set password for root@localhost = password('123456');
exit
apache命令
systemctl start httpd #启动apache 或者是:service httpd start
systemctl stop httpd #停止apache 或者是:service httpd stop
systemctl restart httpd #重启apache 或者是:service httpd restart
systemctl enable httpd #设置apache开机启动 或者是:service httpd enable
mysql命令
systemctl enable mysqld #开机启动 或者: service mysql enable
systemctl start mysqld #启动服务 或者: service mysql start
systemctl restart mysqld #重启服务 或者: service mysql restart
systemctl stop mysqld #停止服务 或者:service mysqld stop