Compile and install MySQL 5.6.20 in CentOS 6.5
Overview:
MySQL 6.5 installed through yum in CentOS 5.1 is old, so I want to install the later version 5.6.20 through the source code.
Body:
I. Uninstall the old version
Run the following command to check whether MySQL Server is installed.
Rpm-qa | if grep mysql exists, run the following command to uninstall it:
Rpm-e mysql // normal deletion Mode
Rpm-e -- nodeps mysql // strong deletion mode. If the above command is used to delete other dependent files, use this command to forcibly delete them. 2. 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
Wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz
Tar xvf mysql-5.6.20.tar.gz
Cd mysql-5.6.20 compilation Installation
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_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLE_DOWNLOADS = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_UNIX_ADDR =/var/lib/mysql. sock \
-DMYSQL_TCP_PORT = 3306 \
-DEXTRA_CHARSETS = all \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci
For parameters compiled by make & make install, see http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html.
The entire process takes about 30 minutes ...... Long wait
Iii. Configure MySQL
Set permissions
Run the following command to check whether mysql users and user groups exist:
Cat/etc/passwd view User List
Cat/etc/group: view the user group list. If no user group list exists, create it.
Groupadd mysql
Useradd-g mysql Modify/usr/local/mysql Permissions
Chown-R mysql: mysql/usr/local/mysql Modify/usr/local/mysql Permissions
Initialize Configuration
Enter the installation path
Cd/usr/local/mysql enter the installation path, execute the initialization configuration script, and create the database and table that comes with the system.
Scripts/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- user = mysql Note: when starting the MySQL service, will search my. cnf, which is first found in the/etc directory. If no cnf is found, "$ basedir/my. cnf ", in this example/usr/local/mysql/my. cnf, which is the default location of the new MySQL configuration file! Note: After the minimal installation of the CentOS 6.4 operating system is completed, a my. cnf, You need to rename this file to another name, such as:/etc/my. cnf. bak. Otherwise, the file will interfere with the correct configuration of MySQL installed by source code, resulting in startup failure.
Start MySQL
Add a service, copy the service script to the init. d directory, and set startup
Cp support-files/mysql. server/etc/init. d/mysql
Chkconfig mysql on
Service mysql start -- start MySQL to configure the user
After MySQL is started successfully, the root user has no password by default. We need to set the root password.
Before setting, we need to set the PATH first, or we cannot directly call mysql
Modify the/etc/profile file and add
PATH =/usr/local/mysql/bin: $ PATH
Close the file using export PATH and run the following command to make the configuration take effect immediately.
Source/etc/profile now, we can enter mysql directly in the terminal to enter the mysql Environment
Run the following command to change the root password:
Mysql-uroot
Mysql> set password = PASSWORD ('20140901'); if you want to SET the root user to allow remote access, run
Mysql> grant all privileges on *. * TO 'root' @ '172. 16.% 'identified BY 'Password' with grant option; when the red password is used for remote access, the root user password may be different from the local password.
Configure Firewall
Port 3306 of the firewall is disabled by default. To access the firewall remotely, you must enable this port.
Open/etc/sysconfig/iptables
In "-a input-m state -- state NEW-m tcp-p-dport 22-j ACCEPT", add:
-A input-m state -- state NEW-m tcp-p-dport 3306-j ACCEPT, save the file, close the file, run the following command on the terminal, and refresh the Firewall Configuration:
Service iptables restart OK. After all configurations are completed, you can access your MySQL instance ~
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
For more information, see the next page: