Install MySQL5.5.54 through rpm under CentOS7
- 1. Check whether you have installed MySQL (mariadb version, if you have installed it, uninstall first, and then install
)
Command: rpm --qa | grep -i mariadb -i ignore case
-
2. Uninstall MySQL; --nodeps exclude dependencies, otherwise other software depends on mysql and cannot be deleted
Command: rpm -e --nodeps mariadb-libs
-
3. Install the MySQL client and server,
copy them to the usr/local/mysql file (anywhere)
MySQL-server-5.5.54-1.linux2.6.x86_64.rpmMySQL-client-5.5.54-1.linux2.6.x86_64.rpm
3.1 Install the client
rpm -ivh MySQL-server-5.5.54-1.linux2.6.x86_64.rpm
3.2 Install server
rpm -ivh MySQL-client-5.5.54-1.linux2.6.x86_64.rpm
4. To check whether the installation is successful, you need to increase -i without distinguishing between upper and lower case, otherwise the search will not be possible.
rpm -qa|grep -i mysql
5. Start mysql and view the status
service mysql status
service mysql start
6. The default root account has no password
mysql -u root -p and press
Enter (no password)
7. Modify the password /usr/bin/mysqladmin -u root password'your password'
8. The default latin1 character encoding, does not support Chinese
show variables like ‘character%’;
9. Set utf8 character encoding, support Chinese
Modify my.cnf
Copy my-huge.cnf under the /usr/share/mysql/ directory to /etc/ and name it my.cnf. Modify the file name (mv)
Then modify my.cnf:
add the corresponding configuration under [xxx]
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
[mysql]
default-character-set=utf8
10. Restart mysql
service mysql restart