Install MySQL5.6.16 in RPM mode in Centos 6.5
This document describes how to install MySQL5.6.16 using RPM. The detailed steps are as follows. Note that different versions may have different installation methods.
- Check whether MySQL and related RPM packages are installed. If yes, remove (rpm-e name)
[Root @ purecentosLinux] # rpm-qa | grep-imysql
Mysql-libs-5.1.71-1.el6.x86_64
[Root @ purecentosLinux] # yum-yremovemysql-libs *
- Download the RPM package corresponding to Linux, for example, the RPM package corresponding to CentOS6.4 _ 64, as shown below:
- Install MySQL. This step depends on some third-party rpm packages. It is best to have the yum source installed.
Yum-y -- nogpgcheck localinstall MySQL *
- Create a configuration file (this step varies depending on the database version)
[Root @ purecentosLinux] # cp/usr/share/mysql/my-default.cnf/etc/my. cnf
- Initialize MySQL
[Root @ purecentosLinux] #/usr/bin/mysql_install_db
[Root @ purecentosLinux] # servicemysqlstart
- Set Password
- View the random password (this step varies depending on the database version)
[Root @ purecentosLinux] # cat/root/. mysql_secret
# TherandompasswordsetfortherootuseratWedDec3008: 18: 472015 (localtime): IlYDRZCs
- Log on with a random password
[Root @ purecentosLinux] # mysql-uroot-pIlYDRZCs
- Set new password
Mysql> SETPASSWORD = PASSWORD ('20140901 ');
- Common configurations
- Allow Remote Login
Mysql> use mysql;
mysql>selecthost,user,password from user;
mysql>update usersetpassword=password('123456') where user='root';
mysql> update usersethost='%'where user='root'and host='localhost';
Mysql> flush privileges;
mysql>exit
- Set auto-start
[Root @ purecentosLinux] # chkconfigmysqlon
[Root @ purecentosLinux] # chkconfig -- list | grepmysql
Mysql0: off1: off2: on3: on4: on5: on6: off
- Default installation location of MySQL
/var/lib/mysql/# Database directory
/usr/share/mysql# Configuration file directory
/usr/bin# Related command Directories
/etc/init.d/mysql# Startup Script
- View Character Set
Show variables like '% collation % ';
Show variables like '% char % ';
- By default, port 3306 is intercepted by the firewall. To simplify the process, you can directly disable the firewall.
Service iptables stop
Chkconfig iptables off
- Modify the default configuration
Modify the character set and data storage path, configure the/etc/my. cnf file, modify the data storage path, mysql. sock path, and default UTF-8 encoding.
[Client] password = 123456 port = 3306default-character-set = utf8 [mysqld] port = 3306character_set_server = utf8character_set_client = utf8collation-server = character = 1 # (note that after mysql is installed in linux, the default is: table names are case sensitive and column names are case insensitive. 0: case sensitive and 1: Case Insensitive.) max_connections = 1000 # (sets the maximum number of connections. The default value is 151, the maximum number of connections allowed by the MySQL server is 16384.) max_allowed_packet = 16Minnodb_buffer_pool_size = 256Minnodb_additional_mem_pool_size = 20 M [mysql] default-character-set = utf8