1, installation ensure the following system related library files # yum–y install gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libmcrypt* L Ibtool*2, build MySQL installation directory and data storage directory # mkdir /usr/local/mysql# mkdir /var/mysqldata3, Create user and user groups # Groupadd mysql# useradd-g MySQL mysql4, give Data directory permissions # chown MYSQL.MYSQL–R/VAR/MYSQLDATA/5, Install cmakemysql5.5 after the CMake to compile through the following path to download cmake-2.8.4.tar.gz, can also be downloaded from the http://www.cmake.org website # wget/http www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz# tar zxvf cmake-2.8.4.tar.gz# cd cmake-2.8.4#./bootstrap# Gmake & & Gmake install II, install MySQL 5.5.211, get decompression mysql-5.5.21.tar.gz download mysql-5.5.21.tar.gz via the following path, also available in HTTP ://www.mysql.com/downloads/mysql official website Download # wget http://mirrors.sohu.com/mysql/mysql-5.5/mysql-5.5.21.tar.gz # tar zxvf mysql-5.5.21.tar.gz# cd mysql-5.5.212, compile mysql-5.5.21# cmake-dcmake_install_prefix=/usr/local/ MySQL \-dmysql_unix_addr=/var/mysqldata/mysql.sock \-ddefault_charset=utf8 \-Ddefault_collation=utf8_general_ci \-DWITH_EXTRA_CHARSETS:STRING=UTF8,GBK \-dwith_myisam_storage_engine=1 \-DWITH _innobase_storage_engine=1 \-dwith_memory_storage_engine=1 \-dwith_readline=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_ Datadir=/var/mysqldata \-dmysql_user=mysql \-dmysql_tcp_port=3306# make# make install3, copy config file # CP Support-files/my-medium.cnf/etc/my.cnf4, Initialize database Execute permissions to assign scripts/mysql_install_db file before execution # chmod 755 scripts /mysql_install_db# scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/\--datadir=/var/mysqldata/ Note: Basedir:mysql installation path DATADIR: Database file storage path 5, Setup mysqld boot up # CP support-files/mysql.server/etc/init.d/ mysql# chmod 755/etc/init.d/mysql# chkconfig MySQL on6, MySQL config environment variable adds MySQL bin directory to path for later management and maintenance, in/etc Add Myslq/bin to/profile and add two aliases for ease of operation : # export Path=/usr/local/mysql/bin: $PATH # alias mysql_start= "Mysqld_safe & "# alias mysql_stop=" Mysqladmin–u root-p shutdown "7, start MySQL service #/etC/init.d/mysql start after start, use ps-ef |grep mysql command to see if startup 8, login mysql# mysql-u root–p Three, MySQL standard settings 1, Set the initial password for the root account #/usr/local/mysql/bin/mysqladmin-u root password ' new-password ' or restrict login only via native #/usr/local/mysql/ Bin/mysqladmin-u root-h ' hostname ' password ' new-password ' 2, Delete this machine anonymous connection empty password account native login mysqlmysql>use MySQL; Select the default database mysqlmysql>update user set password= ' root123 ' where user = ' 127.0.0.1 '; mysql>delete from user where passwo Rd= "";//Do not allow the root password to be empty Mysql>flush privileges;mysql>quit allow the root user is telnet to the root account, if you consider security should create a new account for remote login, The root account does not have to be remotely opened. However, for the general use of  , there is not much security requirements, allowing root users to Telnet can be easily managed, after all, the use of specialized management software graphical interface in the operation of the more convenient. 3, set up MySQL remote connection 1) MySQL database-side Setup #/mysql-u root-p //into the database mysql>use Mysqlmysql>select user,password,host from user;mysql>update user Set host = ' 192.168.% ' where user = ' 127.0.0.1 '; mys Ql>grant all privileges on * * to [email protected] '% ' identified by ' root123 ';//Give the [email protected] Login remote Connection The right limit to connect to the database. Causes of common problems that cannot be connected remotely. and set the Telnet user's password to rootmysql> flush Privileges;mysql>quit
CENTOS6 installation under mysql-5.5.21