One: Uninstall the old version
Use the following command to check if MySQL Server is installed
Rpm-qa | grep MySQL
Some words are unloaded by the following command
RPM-E MySQL//normal delete mode rpm-e--nodeps MySQL//brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted
Two: Install MySQL install the package required for compiling code
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
Download MySQL 5.6.14
: http://dev.mysql.com/downloads/mysql/
Tar xvf mysql-5.6.19.tar.gzcd mysql-5.6.19
Compiling the installation
Cmake-dcmake_install_prefix=/usr/local/mysql5-dsysconfdir=/etc-dwith_myisam_storage_engine=1-dwith_innobase_ Storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_unix_addr=/var/lib/mysql/mysql.sock- Dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_ Charset=utf8-ddefault_collation=utf8_general_cimake && make Install
Three: Configure MySQL settings permissions
Use the following command to see if there are MySQL users and user groups
CAT/ETC/PASSWD View user list Cat/etc/group View user Groups list
If not, create
Groupadd mysqluseradd-g MySQL MySQL
Modify/USR/LOCAL/MYSQL5 Permissions
Chown-r MYSQL.MYSQL/USR/LOCAL/MYSQL5
Initialize configuration
Go to installation path
Cd/usr/local/mysql5
Enter the installation path, execute the initialization configuration script, create the system's own database and table
scripts/mysql_install_db--BASEDIR=/USR/LOCAL/MYSQL5--datadir=/usr/local/mysql5/data--user=mysql
Note: When starting the MySQL service, will be in a certain order to search my.cnf, first in the/etc directory, find will search "$basedir/my.cnf", in this case is/usr/local/mysql/ MY.CNF, this is the default location for the new MySQL configuration file! Note: After the minimum installation of the CentOS version 6.4 operating system, there will be a my.cnf in the/etc directory, which will need to be renamed to a different name, such as:/etc/ My.cnf.bak, otherwise, the file will interfere with the correct configuration of the source installed MySQL, resulting in the inability to start.
Start MySQL
Add services, Copy service scripts to the INIT.D directory, and set boot boot
CP support-files/mysql.server/etc/init.d/mysqldchkconfig mysqld onservice mysqld Start--Start MySQL
Configure users
After MySQL starts successfully, Root does not have a password, we need to set the root password.
Before setting, we need to set path, or we can't call MySQL directly
Modify the/etc/profile file to add at the end of the file
Path=/usr/local/mysql/bin: $PATHexport PATH
Close the file, run the following command, and let the configuration take effect immediately
Source/etc/profile
Now we can enter MySQL directly into the terminal in MySQL environment
Execute the following command to modify the root password
Mysql-uroot mysql> Use mysql;mysql> select User,host,password from user;
+------+-----------+----------+
| user | Host | password |
+------+-----------+----------+
| Root | localhost | |
| Root | dev | |
| Root | 127.0.0.1 | |
| Root | :: 1 | |
| | localhost | |
| | dev | |
+------+-----------+----------+
6 rows in Set (0.00 sec)
Keep the first line of root information, delete all of the following
mysql> Delete from user where host= ' dev ';mysql> delete from user where host= ' 127.0.0.1 ';mysql> delete from user W Here host= ':: 1 ';
Modify Host,password Information
mysql> Update user set host= '% ' where user= ' root ';mysql> update user set Password=password (' 123456 ') where user= ' roo T ';mysql> Delete from user where host= ' localhost ';
Make the changes effective
mysql> flush Privileges;
OK, configuration complete, done!
This article is from the "A sample" blog, please make sure to keep this source http://yayang.blog.51cto.com/826316/1439813