1. installation package Download:
Official website Https://dev.mysql.com/downloads/mysql/5.6.html#downloads, I downloaded this version mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
Upload to Linux under/usr/software after download is complete
2. Unpack the installation package
Unzip in the/usr/software directory
Tar zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
Rename:
Mkdir-p/application/
MV Mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz/application/mysql
3. Create user
Useradd-s/sbin/nologin-m MySQL
4. Create a soft connection
A soft connection is equivalent to a file alias, which is equivalent to a shortcut in window: Ln-s/application/mysql-5.6.34//application/mysql
5. Let MySQL user manage MySQL soft connection
Chown-r mysql.mysql/application/mysql/
6. Copy script to linux boot file directory
Cp/application/mysql/support-files/mysql.server/etc/init.d/mysqld
chmod +x/etc/init.d/mysqld
7. Modify the path in the startup script and MySQL command
Sed-i ' S#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe/etc/init.d/mysqld
8. Copy the default configuration file
Cp/application/mysql/support-files/my-default.cnf/etc/my.cnf
/etc/init.d/mysqld start service, there will be a malfunction
Plus initialization command:
mysql_install_db--user=mysql--basedir=/application/mysql--datadir=/application/mysql/data
Start again successfully
9.PATH Path
Echo ' Export path=/application/mysql/bin: $PATH ' >>/etc/profile
Source/etc/profile
which MySQL
10 adding power-on self-boot
Chkconfig--add mysqld
Chkconfig mysqld on
11. mysql Prompt error: Access denied for user ' root ' @ ' localhost
Workaround:
First Step: Stop service
/etc/init.d/mysql stop
Step Two: Skip password verification
To execute the command line:
#/usr/bin/mysqld_safe--skip-grant-tables
Then exit the login again to execute
/application/mysql/bin/mysqladmin-u root-p password ' 123456 ', will be prompted to enter the password, enter the password: 123456
Then log back in to the database hint
Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
At this point you change the/etc/my.cnf file and add the Socket=/tmp/mysql.sock
Modify the user to save, login again successfully entered
MySQL installation under Linux