Install mysql5.7 on Centos and mysql5.7 on centos
1. Download mysql57-community-release-el6-8.noarch.rpm from mysql Official Website
2. Install the rpm downloaded in step 1
rpm -ivh mysql57-community-release-el6-8.noarch.rpm
3. After the installation is complete, we found that two new files are added under the/etc/yum. repos. d directory. The second file records the mysql source information.
1 mysql-community.repo2 mysql-community-source.repo
4. view available mysql installation sources
yum repolist enabled | grep mysql 1 mysql-connectors-community MySQL Connectors Community 212 mysql-tools-community MySQL Tools Community 243 mysql57-community MySQL 5.7 Community Server 56
5. Use yum to install mysql (automatically solves the dependency problem and installs other related packages) (if you need to save the downloaded package, modify/etc/yum. conf and
Change keepcache = 0 to keepcache = 1)
yum install mysql-community-server
Installing:
Mysql-community-libs i686 5.7.13-1. el6 mysql57-community 2.0 M
Replacing mysql-libs.i686 5.1.73-3. el6_5
Mysql-community-libs-compat i686 5.7.13-1. el6 mysql57-community 1.6 M
Replacing mysql-libs.i686 5.1.73-3. el6_5
Mysql-community-server i686 5.7.13-1. el6 mysql57-community 140 M
Installing for dependencies:
Mysql-community-client i686 5.7.13-1. el6 mysql57-community 22 M
Mysql-community-common i686 5.7.13-1. el6 mysql57-community 327 k
Updating for dependencies:
Postfix i686. 6.6-6. el6_7.1 base 2.0 M
Transaction Summary
========================================================== ========================================================== ====================
Install 5 Package (s)
Upgrade 1 Package (s)
6. Check the mysql service status after the installation is complete.
sudo service mysqld status mysqld (pid 26422) is running...
7. Stop the mysql service and start mysql in safe mode.
1 sudo service mysql stop2 sudo mysqld_safe --skip-grant-tables --skip-networking &
8. log on to the root account without a password and set the root password.
1 mysql -u root2 3 4 mysql> use mysql;5 mysql>update user set authentication_string=password('12345678') where user='root';6 mysql> flush privileges;
9. Modify the character set to utf8
Vim/etc/my. add character-set-server = utf8 in the [mysqld] section to add the [client] segment at the end of the file, and add default-character-set = utf8 in the [client] segment.
10. View characters
show variables like "%character%";+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+| character_set_client | utf8 || character_set_connection | utf8 || character_set_database | utf8 || character_set_filesystem | binary || character_set_results | utf8 || character_set_server | utf8 || character_set_system | utf8 || character_sets_dir | /usr/share/mysql/charsets/ |+--------------------------+----------------------------+