参考网址:https://jingyan.baidu.com/article/9c69d48f87ff2913c8024e69.html
centos7默认将mariadb视作mysql。
p.s.因为mysql被oracle收购后,原作者担心mysql闭源,所以又写了一个mariadb,这个数据库可以理解为mysql的分支。
卸载mariadb才能安装mysql。
卸载mariadb的方法:
#列出所有被安装的rpm package
rpm -qa | grep mariadb
#逐个删除每一个列出来的文件,--nodeps强制删除
rpm -e --nodeps mariadb- libs-************.x86_64
官网下载安装mysql-server
# 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
安装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服务,与开机启动无关] 说明: apache的配置文件是/etc/httpd/conf下modules放在/usr/lib/httpd下php的配置文件在/etc/php.d/下 和/etc/php.iniphp的modules放在/usr/lib/php/modules下
绑定域名
在/etc/httpd/conf/httpd.conf配置文件中,提供了范例:
# # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *:80> # ServerAdmin [email protected] # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #</VirtualHost>
说明:
MySQL默认安装的后,root密码为空.
时间: 2024-10-09 22:49:35