Installation and configuration method of mysql 5.7. 19 under centos 6.5
- 2021-09-05 01:11:10
- OfStack
centos 6.5 Detailed steps for installing mysql 5.7. 19 are as follows
1. Download mysql 5.7. 19 from the oracle website
2. Add centos user group and user MySQL
groupadd mysql
useradd mysql -g mysql
3. Unzip the files to be installed into the specified directory,
You need to set up the chown 755 directory, which allows mysql access.
4. Find bin in the extracted mysql directory, and there is mysqld executable file in bin. Execute
./mysqld --user=mysql --basedir=/home/mysql/mysql-5.7.16-linux-glibc2.5-x86_64 --datadir=/home/mysql/data --initialize
5. Copy my-defalut. cnf from the support-files directory under the installation directory to/etc/my. cnf
6. Copy mysql. service from support-files directory to/etc/init. d/mysqld
7. Set up the connection of mysql, and connect mysql in bin under the installation directory to/usr/local/bin
ln -fs /home/mysql/mysql-5.7.16-linux-glibc2.5-x86_64/bin/mysql /usr/local/bin/mysql
8. Revision/etc/my. cnf
Settings
basedir=/home/mysql
datadir=/home/mysql/data
user=mysql
9. service mysql start starts mysql
10. mysql-uroot Connection mysql Prompt root @ localhost Login is not allowed, password needs to be set
Turn off mysql first
Revision/etc/my. cnf
Adding skip-grant-tables to mysqld
Enable mysql
Enter
mysql > UPDATE mysql.user SET authentication_string=password('123456') WHERE User='root' AND Host='localhost';
Modify the root password.
Or enter mysql > set password=password('123456');
11. Set the character type of the database
Edit/etc/my. cnf
Added in mysqld
character-set-server=utf8
Added in client
default-character-set=utf8
12. View the character types of the database
mysql > show variables like "%character%";
Wonderful topic sharing: mysql installation tutorials for different versions mysql5.7 installation tutorials for different versions mysql5.6 installation tutorials