Install Mysql 5.6.35 on Centos 6.8
1 download
: Https://dev.mysql.com/downloads/mysql/5.6.html#downloads
Here I select 5.6.35 Linux-Generic, for example:
Then select Linux-Generic (glibc 2.5) (x86, 64-bit), Compressed TAR Archive, and select 32 or 64-bit based on the system, for example:
Click to download
2. Decompress
Log on as the root user and upload the installation package to the server.
cd /opt
rz
Extract
tar -zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
Copy the decompressed mysql directory
cp -r mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
3. Add User Groups and users
Add User Group
groupadd mysql
Add mysql user to user group
mysql useradd -g mysql mysql
4 installation
cd /usr/local/mysql
mkdir ./data/mysql
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
cp support-files/my-default.cnf /etc/my.cnf
Modify Startup Script
vi /etc/init.d/mysql
Modify item:
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/mysql
Add environment variables and edit/etc/profile so that mysql commands can be used anywhere.export PATH=$PATH:/usr/local/mysql//bin
source /etc/profile
Start mysql
service mysql start
Test connection
mysql -uroot
Disable mysql
service mysql stop
View running status
service mysql status
Auto-start Configuration
chkconfig --add mysql
chkconfig --list
chkconfig --level 345 mysql on
5. Notes
5.1 error 1130 is reported when sqlyog is connected because the remote connection user permission is not granted.
Solution 1: Change the 'host' entry in the 'mysql' database 'user' table and change it from 'localhost' to '% '.
use mysql
select 'host' from user where user='root'
update user set host = '%' where user ='root'
flush privileges;
Solution 2: direct authorization
GRANT ALL PRIVILEGES ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘youpassword’ WITH GRANT OPTION
5.2 installation errors
-Bash:./scripts/mysql_install_db:/usr/bin/perl: bad interpreter: No file or directory
Solution: yum-y install perl-devel
Installing MySQL system tables .... /Bin/mysqld: error while loading shared libraries: libaio. so.1: cannot open shared object file: No such file or directory
Solution: yum-y install libaio-devel