先新建一个 repo
# vi /etc/yum.repos.d/alt.ru.repo
[CentALT]
name=CentALT Packages for Enterprise Linux 5 - $basearch baseurl=http://centos.alt.ru/repository/centos/5/$basearch/
enabled=1
gpgcheck=0
protect=1
启用 EPEL repo
i386
rpm -ihv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
x86_64
rpm -ihv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
好了,一键安装
# yum install nginx php-fpm mysql mysql-server
更完整的安装
yum -y update
yum -y mysql mysql-server
mysqladmin -u root password root
yum -y install nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator
# APC 和 eAccelerator 有冲突,2选1
yum -y install php-pecl-apc
看下我的完整安装,只要一句
yum -y install nginx mysql mysql-server php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator
启用mysql:
service mysqld start
1.测试mysql以及简单配置
mysql> select user,host,password from mysql.user; ← 查看用户信息
mysql> set password for root@localhost=password('在这里填入root密码'); ← 设置root密码
Query OK, 0 rows affected (0.01 sec)
mysql> set password for root@'sample.centospub.com'=password('在这里填入root密码'); ← 设置root密码
Query OK, 0 rows affected (0.01 sec)只有设置了这个才可以,才可以通过数据库来安装网址
删除匿名用户
在MySQL刚刚被安装后,存在用户名、密码为空的用户。这使得数据库服务器有无需密码被登录的可能性。为消除隐患,将匿名用户删除。
mysql> delete from mysql.user where user=''; ← 删除匿名用户
Query OK, 2 rows affected (0.17 sec)
mysql> create database test; ← 建立名为test的数据库
Query OK, 1 row affected (0.00 sec)