MySQL-5.5.38 universal binary Installation
1. System Environment: CentOS 6.5 _ x86
2、mysql-5.5.38-linux2.6-i686.tar.gz
The file name format for the MySQL binary distribution is mysql-VERSION-OS.tar.gz, where VERSION is the VERSION number (for example, 5.1.51) and OS represents the operating system type (for example, linux-i686) for the distribution installation ).
Why use a universal binary package?
Because MySQL is often installed for testing, it is generally installed in the source code mode, but the source code installation requires a long time to compile, although the source code compilation performance is good, however, we can adjust it through the configuration file. The source code method is heavily dependent on the operating system environment.
In addition, the general binary package can be easily transplanted, and the official optimization options are also made. Therefore, we recommend that you use a universal binary package to install MySQL.
How can I perform binary installation and upgrade?
The upgrade still obtains the binary compressed package. During the installation, we will create a link. During the upgrade, We will directly switch to the new MySQL directory.
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
Installation Process?
1. Create mysql users and groups
[Root @ localhost ~] # Groupadd-r mysql
[Root @ localhost ~] # Useradd-r-g mysql-s/sbin/nologin mysql
2. Create a mysql data storage directory (it is recommended that the directory be a separate partition and a logical volume)
Here, I am directly lazy and use/mydata/data as the data directory:
[Root @ localhost ~] # Mkdir-pv/mydata/data
Because mysql users in this directory need to read and write data, we change the owner and group to mysql.
[Root @ localhost ~] # Chown-R mysql: mysql/mydata/data
3. Decompress
Normally, we are used to extracting data to the/usr/local/src directory.
[Root @ localhost ~] # Tar mysql-5.5.38-linux2.6-i686.tar.gz-C/usr/local/src
# To facilitate the upgrade, we will create a soft link. You can re-create this link during the next upgrade.
[Root @ localhost ~] # Cd/usr/local
[Root @ localhost local] # ln-sv src/mysql-5.5.38-linux2.6-i686 mysql
'Mysql'-> 'src/mysql-5.5.38-linux2.6-i686'
In fact, this step is to provide a quick operation method. In fact, it can be used without establishing a soft connection. Why?
Update management is useful: the new version creates a separate directory for storage. Assume that you have upgraded mysql. You only need to modify the directory to which the soft connection points.
4. initialize the database
[Root @ localhost local] # cd/usr/local/mysql
[Root @ localhost mysql] # scripts/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/mydata/data -- user = mysql
# -- Basedir specifies the mysql base Directory
# -- Datadir specifies the data directory
# -- User specifies the user
This step is critical. If the operation fails, check whether the operation is incorrect or missing.
For security, we changed the directory owner and group of Mysql programs to root: root.
[Root @ localhost mysql] # chown-R root: root/usr/local/src/mysql-5.5.38-linux2.6-i686/
5. Copy the Mysql Service Startup Script and configuration file.
# Copy the Service Startup Script
[Root @ localhost mysql] # cp support-files/mysql. server/etc/init. d/mysqld
# Add sysV
[Root @ localhost mysql] # chkconfig -- add mysqld
# Start startup
[Root @ localhost mysql] # chkconfig mysqld on
# Copy the configuration file
[Root @ localhost mysql] # cp support-files/my-medium.cnf/etc/my. cnf
6. Start the service
[Root @ localhost etc] # service mysqld start
Starting MySQL... SUCCESS!
[Root @ localhost etc] # netstat-tulpn | grep 3306
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 3834/mysqld
# OK. We can see that the mysqld listener is on port 3306.
7. Add the bin directory of mysql to PATH
[Root @ localhost ~] # Vim/etc/profile. d/mysql. sh
# Add the following line
Export PATH = $ PATH:/usr/local/mysql/bin
[Root @ localhost ~] #./Etc/profile. d/mysql. sh
# Make some simple security settings and select [Y/n] As prompted
[Root @ localhost mysql] #/usr/local/mysql/bin/mysql_secure_installation
8. Perform some configuration
Modify MANPATH so that the man command can find the mysql help documentation
# Vim/etc/man. config
# Add the following content
MANPATH/usr/local/mysql/man
Add header file
# Ln-sv/usr/local/mysql/include/usr/include/mysql
'/Usr/include/mysql'->'/usr/local/mysql/include'
Add library files
# Vim/etc/ld. so. conf. d/mysql. conf
# Add the following content
/Usr/local/mysql/lib
Take effect again
# Ldconfig-v | grep mysql
For more details, please continue to read the highlights on the next page: