wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
2.Installing MySQL with Yum
sudo yum install mysql-community-server
3.editing /etc/my.cnf
[mysqld]
innodb_buffer_pool_size = 2G
join_buffer_size = 128M
sort_buffer_size = 6M
read_rnd_buffer_size = 2M
character-set-server=utf8
key_buffer_size = 512M
max_allowed_packet = 10M
thread_stack = 256K
myisam_sort_buffer_size = 64M
max_connections = 1000
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
4.Starting the MySQL Server
sudo service mysqld start
5.Securing the MySQL Installation Invoke mysql_secure_installation without arguments:shell> mysql_secure_installation
When executed, the script prompts you to determine which actions to perform.
二、使用rpm包安装
安装时请使用root用户。安装前准备两个rpm包:
MySQL-server-5.6.12-1.el6.x86_64.rpm
MySQL-client-5.6.12-1.el6.x86_64.rpm
1、安装服务端:命令:rpm -ivh MySQL-server-5.6.12-1.el6.x86_64.rpm
2、安装客户端命令:rpm -ivh MySQL-client-5.6.12-1.el6.x86_64.rpm
3、在Redhat中是不能使用空密码登录mysql的,请依次执行以下命令:su root
service mysql stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('123456') where USER='root';
FLUSH PRIVILEGES;
quit
exit
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
service mysql start
执行完毕后,再次登录
mysql -uroot -p123456
4、登录后执行mysql命令时,还会提示设置密码,再次运行以下命令:
SET Password=PASSWORD('123456')