-
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 CentOS 7.0 yum安装Apache、PHP和MySQL
-
安装apache扩展
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql CentOS 7.0 yum安装Apache、PHP和MySQL
-
安装php的扩展
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc CentOS 7.0 yum安装Apache、PHP和MySQL
-
安装MySQL的扩展
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql CentOS 7.0 yum安装Apache、PHP和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下 CentOS 7.0 yum安装Apache、PHP和MySQL
-
绑定域名
在/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 webmaster@dummy-host.example.com # 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密码为空.
操作命令总结:
1. apache命令
systemctl start httpd.service #启动apache(后面的.service省略也行) 或者是:service httpd start systemctl stop httpd.service #停止apache 或者是:service httpd stop systemctl restart httpd.service #重启apache 或者是:service httpd restart systemctl enable httpd.service #设置apache开机启动 或者是:service httpd enable
restart一下,然后:
输入localhost
出现之后代表已经安装上去了。
2. 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
初次安装mysql是root账户是没有密码的
设置密码的方法123# mysql -u root
mysql>
set
password
for
root@localhost =
password
(
‘123456‘
); //这里注意自己替换密码
mysql> exit
创建一个可以从任何地方连接服务器的一个完全的超级用户,但是必须使用一个口令
1mysql>
grant
all
privileges
on
*.*
to
user
@localhost identified
by
‘123456’
相关文章
- 03-26Centos 6安装完美搭建mysql、php、apache之旅
- 03-26CentOS yum安装和配置MySQL(转载)
- 03-26Windows XP下安装和配置Apache2.2.22服务器+PHP5+Mysql5
- 03-26Windows下安装和配置Apache2.2.22服务器+PHP5+Mysql5
- 03-26CentOS6.5下安装apache2.2和PHP 5.5.28
- 03-26CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5
- 03-26Centos7:yum安装apache,编译安装php5.6,不解析php的解决方法
- 03-26Centos7安装PHP、安装MySQL、安装apache
- 03-26编译安装centos6.9 php7.0 mysql5.6 nginx1.8
- 03-26Centos7 用yum命令安装LAMP环境(php+Apache+Mysql)以及php扩展