首页 > 代码库 > rhel_6.x 安装mysql

rhel_6.x 安装mysql

不知为何mysql的官网很难下载,本人网上找了好久,终于找到了个镜像:

特别感谢http://mirrors.sohu.com/mysql/MySQL-5.6/    ^_^

 

首先下载mysql的下面三个RHEL6安装包:(可以直接下个MySQL-5.6.22-1.el6.x86_64.rpm-bundle.tar)
MySQL-client-5.6.22-1.el6.x86_64.rpm
MySQL-devel-5.6.22-1.el6.x86_64.rpm
MySQL-server-5.6.22-1.el6.x86_64.rpm
然后使用root账号登陆,进行安装:


1. 安装server、devel、client:

rpm -ivh --replacefiles MySQL-s*.rpm
rpm -ivh --replacefiles MySQL-d*.rpm
rpm -ivh --replacefiles MySQL-c*.rpm

2. 初始化数据库:

/usr/bin/mysql_install_db
3. 启动mysql服务:

service mysql start
4.第一次登陆设置root密码:
首先查看 cat /root/.mysql_secret
# mysql -u root -p
Enter password:

mysql> set password=password(‘admin‘);
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

5. 设置远程登陆:
mysql> use mysql;

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘admin‘ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

mysql> exit;

//取消防火墙的ftp拦截
# iptables -L -n //查看
# system-config-firewall
# mysql -h 192.168.*.* -P 3306 -u root -padmin

6. 设置随开机启动
# chkconfig --add mysql
# chkconfig --level 35 mysql on
# service mysql restart

GOOD!

 

rhel_6.x 安装mysql