First go to http://dev.mysql.com/downloads/mysql/5.6.html download the source code of MySQL, remember that it is source codes, other versions
1. Installing dependent Packages
Yum-y install CMake gcc-c++ Bison ncurses ncurses-devel
2. Create a MySQL installation directory and database storage directory
Mkdir-p/usr/local/-p/usr/local/mysql/data
3. Create MySQL users and user groups
-r-g MySQL MySQL
4. Install MySQL, need cmake compile, if the compilation fails, generally for the dependency package is not full
Tar zxvf mysql-5.5. - . tar.gz cd mysql-5.5. - -dcmake_install_prefix=/usr/local/-dmysql_datadir=/usr/local/mysql/-ddefault_ charset=-ddefault_collation=-dextra_charsets=-denabled_local_infile=1 # #注意带-
Parameter description:
-dcmake_install_prefix=/usr/local/mysql//installation directory
-dinstall_datadir=/usr/local/mysql/data//Database storage directory
-ddefault_charset=utf8//using UTF8 characters
-DDEFAULT_COLLATION=UTF8_GENERAL_CI//Check character
-dextra_charsets=all//Install all extended character sets
-denabled_local_infile=1//Allow import of data from local
Precautions:
When you recompile, you need to clear the old object file and cache information.
--rf/etc/my.cnf
5. Set directory Permissions
cd/usr/local/-R mysql:mysql Data
6. Add the MySQL startup service to the system service
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
CP Support-files/mysql.serve/etc/init.d/mysqld
chmod 755/etc/init.d/mysqld
Chkconfig--add mysqld
Chkconfig mysqld on
Service mysqld Start #启动服务
7. Create a table for the system database
/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
8. Setting Environment variables
vim/root/. bash_profile# in Path= $PATH: $HOME/Bin add parameter is: PATH= $PATH: $HOME/bin:/usr/local/mysql/bin :/usr/local/mysql//root/.bash_profile
9. Start MySQL
' Root ' -uroot-proot (empty if no password is set )
10. Set user rights (optional), default initial user does not have Telnet permission, if you want to use remote client access, you need to turn on permissions
Grant all on * * to [email protected]'%'123';
MySQL Source installation