1. Download: current MySQL version to 5.6.20
Http://dev.mysql.com/downloads/mysql
ChooseSource Code
2. Necessary Packages
Yum-y Install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* Make CMake
3. Compile and installAdd user
Groupadd mysqluseradd-r-G MySQL MySQL
Compiling the installation
TAR-ZXVF MYSQL-5.6.20.TAR.GZCD mysql-5.6.20# is installed by default in/usr/local/mysqlcmake. Make && make install
Compile parameters
CMake.-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-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_ci
The compiled parameters can be referenced http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
Change Directory Owner
Chown-r Mysql.mysql/usr/local/mysql
4. Initialize the database
cd/usr/local/mysql/scripts./mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/ Data
5, registered as a service
cd/usr/local/mysql/support-files# Registry Service CP mysql.server/etc/rc.d/init.d/mysql# using default profile CP my-default.cnf/etc/my.cnf# Let Chkconfig manage MySQL service chkconfig--add mysql# boot up chkconfig MySQL on
6. Start the MySQL service
Service MySQL Start
7, change the code, prevent garbled
SHOW VARIABLES like ' character% '
Modify the MySQL my.cnf file
[Client]default-character-set=utf8[mysqld]character-set-server=utf8[mysql]default-character-set=utf8
8. Add the MySQL bin to path
CD ~ #我把path添加到当前用户目录的bashrc中, if you need global settings, modify the '/etc/profile ' VI bashrc# Add the following path=/usr/local/mysql/bin: $PATHexport PATH
9. Configure user passwords and remote access permissions
Mysql-uroot SET PASSWORD = PASSWORD (' 123456 '); GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
Reference:
Http://blog.163.com/[email protected]/blog/static/815232582013885310900/
Http://www.cnblogs.com/xiongpq/p/3384681.html