Linux version: CentOS6.5 64-bit
1. Download the installation package "mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz"
to MySQL website download mysql compiled binary installation package, on the download page select Platform: Option Select Linux-generic, then pull the page to the bottom, 64-bit system download linux-generic (GLIBC 2.5) (x86, 64-bit), 32-bit system download linux-generic (GLIBC 2.5) (x86, 32-bit)
Find the top right corner, find the previous version, find the 5.6 version, download it.
# Install dependent yum-y Install Perl perl-devel autoconf
2. Move the downloaded installation package to/usr/local/.
3. Decompression
TAR-ZXVF mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
4, copy the extracted MySQL directory to the local software directory of the system
CP Mysql-5.6.33-linux-glibc2.5-x86_64/usr/local/mysql-r
5. Add System MySQL group and MySQL user
Groupadd MySQL
Useradd-r-G mysql-s/bin/false MySQL
Note: Because the user is required only for ownership purposes, not login purposes, the Useradd command uses the-r and-s/b In/false options to create a user this does not has a login permissions to your server host. Omit these options if your useradd does not support them.
6, go to install MySQL software directory, modify the directory owner for the MySQL user
CD mysql/
Chown-r Mysql:mysql./
7. Install the database, there may be errors here.
./scripts/mysql_install_db--user=mysql
FATAL Error:please Install the following Perl modules before executing scripts/mysql_install_db:
Data::D umper
#解决方法:
Yum Install-y Perl-data-dumper
8, modify the current directory owner is the root user
Chown-r Root:root./
9. Modify the current data directory owner as a MySQL user
Chown-r Mysql:mysql Data
============== to this database installation =============
10. Add mysql service boot from boot
Add boot start and put the startup script into the boot initialization directory.
If you see the MySQL service and the 3,4,5 is on, it succeeds if it is off, then executes
Chkconfig--level 345 MySQL on
11. Start the MySQL service
#创建缺少的文件夹
Mkdir/var/log/mariadb
Service MySQL Start
Normal tip information: starting MySQL. success!
12. Put the MySQL client on the default path
Ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql
Note: It is recommended to use the soft chain in the past, do not directly package file copy, easy to install multiple versions of MySQL system
=================== This is the split line ==================
Connect to the database by using MYSQL-UROOT-P (the default database root user does not have a password, this needs to be set to a password).
Err message : Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
workaround : Open/etc/my.cnf to see what directory the socket is configured in. "Socket=/var/lib/mysql/mysql.sock"
The path and "/tmp/mysql.sock" are inconsistent. Establish a soft connection: Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
The mission is done here. You can then create the database user and then use the database.
13. Modify the root user password of MySQL, the root initial password is empty:
Execute command:./bin/mysqladmin-u root password ' password '
###################### Split Line ######################
Permission control
1. Remove Anonymous Users
# Test Anonymous User Login Mysql-ux3
You can see that anonymous users can log on with the permissions associated with the INFORMATION_SCHEMA and test libraries.
# Delete the anonymous user, log in to the database using the root user delete from mysql.user where user= ';
Flush privileges;
Test Anonymous User Login again
2, in order to facilitate remote management, open 3306 of the firewall.
Vi/etc/sysconfig/iptables
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
3. mysql Remote authorization
Log in to MySQL with Root first:
Mysql-uroot-p
Enter Password:
Perform:
GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
Flush privileges;
You can connect remotely.
Install Mysql5.6 under Linux