Install, configure, and apply MySQL 5.7 in CentOS 7
MySQL 5.7 and earlier versions have some differences. The complete installation, configuration, and application process of MySQL 5.7 in CentOS 7 may be useful for beginners.
The installation described in this article uses a common binary compressed package (linux-Generic) for unzipping, which is equivalent to a green installation. 1. Download the universal installation Binary Package first download the mysql installation package: Open http://dev.mysql.com/downloads/mysql/select linux-Generic and select Linux-Generic (glibc 2.5) (x86, 64-bit) under it ), download Compressed TAR Archive. You can first download to a temporary directory, decompress the package, get two packages: mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz Uninstall this package on the line. 2. Create a user and a directory to create a user mysql group. Mysql uses this user to run later (note that this is also the default user in the mysql STARTUP script, so it is best not to change the name ). # Groupadd mysql # useradd-r-g mysql (using the-r parameter to indicate that a mysql user is a system user and cannot log on) create a directory/work/program, mysql is installed in this directory. # Mkdir/work/program 3. Install unzip to the/work/program directory # tar zxvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz-C/work/program the directory name obtained under program is very long, if you do not want to change the name, you can establish a connection: # ln-s mysql-5.7.11-linux-glibc2.5-x86_64 mysql since then you can use/work/program/mysql to find the installation directory of mysql note, if the mysql directory does not have a data directory, manually create one. [Directory permission settings] Set mysql and all directory owners and groups to mysql: # cd/work/program/mysql # chown mysql: mysql-R. [initialization] #/work/program/mysql/bin/mysqld -- initialize -- user = mysql -- datadir =/work/program/mysql/data -- basedir =/work/program/mysql note: 1. the data directory does not exist after decompression. You need to create it manually (see the previous section); 2. mysql5.7 is different from the previous version. This command is used in many documents ..... /scripts/mysql_install_db -- user = mysql, which is not available in mysql 5.7. After successful initialization, the following message is displayed: 201x-xx-xxT07: 10: 13.583130Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. please use -- explicit_defaults_for_timestamp server option (see documentation for more details ). 201x-xx-xx T07: 10: 13.976219Z 0 [Warning] InnoDB: New log files created, LSN = 45790201x-xx-xx T07: 10: 14.085666Z 0 [Warning] InnoDB: creating foreign key constraint system tables.201x-xx t07:10: 14.1 61899Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. generating a new UUID: 1fa941f9-effd-11e5-b67d-000c2958sp_8.201x-xx-xx T07: 10: 14.165534Z 0 [Warning] Gtid table is not ready to be used. table 'mysql. gtid_executed 'cannot be opened.201x-xx T07: 10: 14.168555Z 1 [Note] A temporary password is generated for root @ localhost: Q1SLew5T_6K. Pay attention to the last line. This is also different from the version. It gives the root initial password, which will be used for Logon later. Change the my-default.cnf under mysql/support-files to my. cnf, copy it to/etc (or test it to {mysql}, and then make a soft link to/etc ): # cp/work/program/mysql/support-files/my-default.cnf/etc/my. cnfmy. key configuration in cnf: [mysqld] basedir =/work/program/mysqldatadir =/work/program/mysql/dataport = 3306 socket =/work/program/mysql/tmp/mysql. sock SQL _mode = NO_ENGINE_SUBSTITUTION. Note that the tmp directory does not exist. create it. If you do not set my. when cnf is copied to/etc, mysqld: Can't change dir to '/usr/local/mysql/data/' (Errcode: 2-No such file or directory. the configuration in cnf, and find the default installation location during program Compilation: /usr/local/mysql 4. Run [run the server program] # {mysql}/bin/mysqld_safe & note: the default setting -- user = mysql has been set in this startup script; add & at the end of the script to set this process as a background process. The difference is that you can enter bg on the console to transfer the current process to the background. Other operations can be performed by the current shell. [Stop mysql] {mysql}/bin/mysqladmin-uroot-p (note that the root user is the root user of mysql) 5. Set mysql to run as a service and start it at {mysql}/support-files/mysql. server copy:/etc/init. d/mysql and set the running permission # cp mysql. server/etc/init. d/mysql # chmod + x/etc/init. d/mysql registers mysql as a startup service # chkconfig -- add mysql can also be enabled and disabled manually: #/etc/init. d/mysql start #/etc/init. d/mysql stop 6. Client connection test # {mysql}/bin/mysql-uroot-p at this time, the password is the one generated during initialization. If an ERROR occurs during service connection: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock '(2) needs to be in my. cnf: [client] socket =/work/program/mysql/tmp/mysql. after the sock is connected, mysql requires that you change the root password before performing any operations. ERROR 1820 (HY000): You must reset your password using alter user statement before executing this statement. mysql> alter user 'root' @ 'localhost' identified by 'xxxxxxx '; VII. TIPS [Check whether mysql is running] ps-ef | grep mysqldnetstat-lnp | grep-I mysql [read the configuration file my when mysql is started. cnf sequence: run the following command to view the cnf sequence :. /bin/mysqld -- verbose -- help | moreDefault options are read from the following files in the given order:/etc/my. cnf/etc/mysql/m Y. cnf/usr/local/mysql/etc/my. cnf ~ /. My. cnf: the configuration file my. cnf can be read from the directory above at startup. If the current my. cnf file is not in the above position, you must pass the test or make a link.
MySQL 5.7 new feature: Generated Column (function index)
Upgrade to MySQL 5.7 to solve the partition problem.
Perfect distributed transaction support for MySQL 5.7
New Features of MySQL 5.7
MySQL 5.7.11 release and download
Install MySQL 5.7.11 for Linux Generic binary in CentOS 7 using command lines