CentOS 6.2 Under install compile MySQL 5.6.23
1 single-instance MySQL database installation
1.1 Creating a MySQL Account
[[email protected] ~]# Groupadd MySQL
[[email protected] ~]# useradd-s/sbin/nologin-g mysql-m MySQL #-m means no home directory created
After the creation is complete, look under
[[email protected] ~]# grep mysql/etc/passwd
Mysql:x:500:500::/home/mysql:/sbin/nologin
1.2 Setting up a MySQL installation directory
[email protected] ~]# mkdir-p/usr/local/mysql
1.3 Download MySQL http://dev.mysql.com/downloads/or go to Sohu image source download and upload to the server
2. Install MySQL
2,1 detect if the system has been installed MySQL
[[email protected] ~]# rpm-qa |grep MySQL
mysql-libs-5.1.61-1.el6_2.1.i686
here is not installed MySQL if there is a need to uninstall MySQL installation package rpm-e--nodeps MySQL first. x.x.x
2,2 Install the packages needed to compile the MySQL compilation
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
If these packages are installed in front of you, you can install them separately.
2,3 unzip MySQL and install
[Email protected] ~]# tar xzvf mysql-5.6.23.tar.gz
[Email protected] ~]# CD mysql-5.6.23
CMake \
-dmysql_user=mysql \
-dcmake_install_prefix=/usr/local/mysql \
-dinstall_datadir=/data/mysql/data \
-dmysql_unix_addr= /var/lib/mysql/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dextra_charsets=all \
-dwith_embedded_server=1 \
-denabled_local_infile=1 \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1
-dmysql_unix_addr= /var/lib/mysql/mysql.sock \ # Socket File
[[email protected] mysql-5.6.23]# make && make install
3. Configure MySQL
3,1 Permissions Configuration
Modify ownership of/usr/local/mysql
chown-r Mysql:mysql/usr/local/mysql
3,2 Initialization Settings
Enter/usr/local/mysql
[email protected] ~]# cd/usr/local/mysql/
Enter the installation path, execute the initialization configuration script, create the system's own database and table
[[email protected] MySQL] #scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/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 new The default location for MySQL configuration files!
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.
After updating the system with Yum Update, you need to check the following/ If there is an additional my.cnf in the ETC directory, rename it to something else. Otherwise, MySQL will start with this configuration file, which may cause problems such as an inability to start properly.
3,3 start MySQL
Configuring the MySQL Service
[Email protected] mysql]# Mv/root/mysql-5.6.23/support-files/mysql.server/etc/init.d/mysql
[email protected] mysql]# chmod 700/etc/init.d/mysql
[[email protected] mysql]# service MySQL start
To add a MySQL service to a startup item
[Email protected] data]# chkconfig--level MySQL on
4. Configure MySQL database
The Connect database command is Mysql-u root-p but first we need to call MySQL to define global variables, otherwise this command won't work.
[email protected] data]# Vi/etc/profile
At the end of the add
Path=/usr/local/mysql/bin: $PATH
Export PATH
or with this command.
[Email protected] data]# echo "Export path=/usr/local/mysql/bin/: $PATH" >>/etc/profile
5. Authorizing remote users to connect to the database
Change root password
mysql> SET PASSWORD = PASSWORD (' 123456 ');
To modify the remote user connection root
Mysql> GRANT All privileges on * * to ' root ' @ ' 172.18.18.212 ' identified by ' 123456 ' with GRANT OPTION; # #172.18.18.212 for client IP
mysql> flush privileges;
This article is from the "Scribbled Life" blog, so be sure to keep this source http://972010.blog.51cto.com/962010/1630753
CentOS 6.2 Under install compile MySQL 5.6.23