在centos6.0下安装Apache2_Mysql_PhpMyAdmin

1.centos 6.0系统进行基本服务器安装

2.配置Yum,替换为中国CentOS镜像服务器[此步骤可跳过]
安装后请按照以下步骤修改CenOS-Base.repo,以后就可以方便的用国内最全最快yum源安装软件了
CentOS 5:
中国科技大学镜像:
cd /etc/yum.repos.d

mv CentOS-Base.repo  CentOS-Base.repo.save

wget http://ctos.ustc.edu.cn/CentOS-Base.repo.5
wget http://ctos.ustc.edu.cn/epel.repo.5
mv CentOS-Base.repo.5 CentOS-Base.repo
mv epel.repo.5 epel.repo
 
Sohu国内的YUM源:

Wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo -o /etc/yum.repos.d/CentaOS-Base.repo

运行yum makecache生成缓存
CentOS 6:
 

Wget http://mirrors.163.com/.help/CentOS6-Base-163.repo  -o /etc/yum.repos.d/CentaOS-Base.repo

 
中国科技大学镜像:
cd /etc/yum.repos.d

mv CentOS-Base.repo  CentOS-Base.repo.save

wget http://ctos.ustc.edu.cn/CentOS-Base.repo.6
wget http://ctos.ustc.edu.cn/epel.repo.6
mv CentOS-Base.repo.6 CentOS-Base.repo
mv epel.repo.6 epel.repo
 
 
3.Import the RPMforge GPG key
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
On x86_64 systems:
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
On i386 systems:
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
[ 使用官方的RPMForge:

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

 

o    i686 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

o    x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm ]

[安装完后需要设置/etc/yum.repos.d/ 目录下的.repo相关文件(如CentOS-Base.repo),在这些文件的第一段最后中插入顺序指令:priority=N N199的正整数,数值越小越优先)]

 
4. 安装 Apache Mysql PhpMyAdmin

yum -y install httpd php mysql mysql-server phpmyadmin php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql

5.设置mysql数据库root帐号密码
mysqladmin -u root password ‘newpassword’ [引号内填密码]
让mysql数据库更安全
mysql -u root -p [此时会要求你输入刚刚设置的密码,输入后回车即可
mysql> use mysql;[打开数据库]
mysql> DROP DATABASE test; [删除test数据库]
mysql> DELETE FROM mysql.user WHERE user = ”; [删除匿名帐户]
mysql> FLUSH PRIVILEGES; [重载权限]
 
6.打开/usr/share/phpmyadmin/config.inc.php文件,进行以下修改
// $cfg['Servers'][$i]['controluser'] = ‘pma’;
// $cfg['Servers'][$i]['controlpass'] = ‘pmapass’;
// $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
// $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
// $cfg['Servers'][$i]['relation'] = ‘pma_relation’;
// $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
// $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
// $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
// $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
// $cfg['Servers'][$i]['history'] = ‘pma_history’;
// $cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’;
去掉每行前面的//;
$cfg['blowfish_secret'] = ”; |修改为| $cfg['blowfish_secret'] = ‘http’;
$cfg['Servers'][$i]['controluser'] = ‘pma’; |把’pma’修改为你的帐号|$cfg['Servers'][$i]['controlpass'] = ‘pmapass’; |把’pmapass设置为你的mysql登录密码
$cfg['blowfish_secret'] = ”; | 添加短语密码例如:$cfg['blowfish_secret'] = ‘onohot’;
7. 修改 /etc/httpd/conf.d/phpmyadmin.conf

#  Web application to manage MySQL

<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all [修改为:Allow from all]
Allow from 127.0.0.1
</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
远程连接 mysql (Apache Mysql 分开安装在不同的机器 ):
需要调整MySQL登陆用户的权限,存储在系统数据库MySQL的user表中。打开这张表,可以发现有一条记录,user字段是root,之后又一系列用于权限的字段,有些初始值是N,需要把它们改成Y,最关键的一点,第一个字段Host,他是localhost或者127.0.0.1,难怪只能本机访问,需要把它改成%,更加通用,所有的机器都能远程访问了

本文出自 “Sharing in China” 博客,谢绝转载!

你可能感兴趣的:(mysql,centos,centos,phpMyAdmin,apache2)