Install mysql5.7.17 in centos5
Download mysql.tar.gz from the official website.MySQL installation package,Linux-Generic 64-bit (64or32 is selected based on the system), you can also use the wget command to download the 64-bit download link: http: // 120.52.72.21/latest2. Create a mysql group and an account, create a mysql group and an account, and set that mysql cannot be logged on (prevent others from using the mysql account to log on to the host) <1>. groupadd mysqluseradd-g mysql mysqlusermod-s/bin/false mysql3. Decompress mysql.tag.gz to decompress the file to/usr/local/and rename it to mysql. <3>. tar-zxvf mysql-5.7.17-linux-glibc2.5-i686.tar.gz rename: mv mysql-5.7.17-linux-glibc2.5-i686 mysql; the structure is as follows (you can also create a directory, basedir, datadir configure your own) move mysql/support-files/my-default.cnf and rename it to/etc/my. cnf <4>. the cp my-default.cnf/etc/my. cnf modify my. basedir, datadir (mysql root directory, data root directory) of the cnf file: basedir =/usr/local/mysql/datadir =/usr/local/mysql/data/ready4. Install mysql. /mysql_install_db -- user = mysql -- basedir =/usr/local/mysql/-- datadir =/software/mysql/data found this prompt: [WARNING] mysql_install_db is deprecated. please consider switching to mysqld -- initializemysql_install_db this command is enabled and installed with mysqld <5> .. /mysqld -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data is printed after installation: the information that mysqld socket can connect (which is probably the case, but cannot be remembered) may be printed as follows: ERROR 1045 (28000): Access de Nied for user 'root' @ 'localhost. The installation is successful, and mysql is started. (If the installation fails, Baidu finds the reason, deletes the files in the data folder, and reinstalls the files.) <6>. establish persistent connection ln-s/opt/mysql/bin/mysql/usr/bin/mysql. If the soft connection already exists, delete the connection and create rm/usr/bin/mysql.Next, modify the mysql initial password: after the old version of mysql is installed, the root initial password is blank and you can log on directly. After the version is installed, a random password command will be assigned: cat/root /. mysql_secret print: # Password set for user 'root @ localhost' at 2016-06-17 00: 46: 53so (flf.5rePB initial Password: so (flf.5rePB to enter the/usr/local/mysql/bin/directory and enter the mysql command :. /mysql-uroot-p enter the initial PASSWORD and SET the new PASSWORD: mysql> set password = PASSWORD ('newpasswd'). If you directly SET the PASSWORD, an error may occur. Follow these steps to SET it: mysql> create database yan1; ERROR 1820 (HY000): You must set password before executing this statementmysql> set password = PASSWORD ('000000'); Query OK, 0 rows affected (0.03 sec) mysql> create database yan1; Query OK, 1 row affected (0.00 sec)5. Add more mysql services, set startup, and set mysql. copy this file to/etc/init. d/directory, and renamed it mysql # cp support-files/mysql. server/etc/init. d/mysql # chmod 755/etc/init. d/mysql // grant the "execute" permission to the mysql file # chkconfig -- add mysql // add to Automatic startup # service mysql restart // restart MySQL