illustrate This article was written on 2017-05-20, using MySQL-5.7.18. The operating system is 64-bit CentOS Linux release 7.2.1511 (Core), installed as a desktop. Uninstall MariaDB CentOS7 installs MariaDB instead of MySQL by default, and the MySQL-related packages are also removed from the yum server. Because MariaDB and MySQL may conflict, uninstall MariaDB first. 1. Check the installed MariaDB related rpm packages. rpm -qa | grep mariadb 2. Check the installed MariaDB-related yum packages. The package name needs to be determined according to the result of the rpm command. yum list mariadb-libs 3. Remove the installed MariaDB related yum packages. The package name needs to be determined according to the result of the yum list command. This step requires root privileges. yum remove mariadb-libs Download MySQL rpm package Since the software package is very large, you can download it using other methods (such as Thunder) first. Using the rpm method, you can also install it without an internet connection - this is something that yum cannot do. If you need to install other versions of MySQL, please go to the official website and search for the corresponding rpm download link. Copy the code as follows: wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar Install MySQL using rpm package The following steps require root privileges. And because of the dependencies between packages, each rpm command must be executed in sequence. mkdir mysql-5.7.18 tar -xv -f mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7.18 cd mysql-5.7.18/ rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm After successful installation, you can also delete the installation files and temporary files. cd .. rm -rf mysql-5.7.18 rm mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar Change the initial MySQL password The following steps require root privileges. 1. Since you don’t know the password at the beginning, first modify the configuration file /etc/my.cnf to let MySQL skip the permission check when logging in. Add a line: skip-grant-tables 2. Restart MySQL. service mysqld restart 3. Log in to MySQL without password. mysql 4. Execute the following command in the mysql client to change the root password. use mysql; UPDATE user SET authentication_string = password('your-password') WHERE host = 'localhost' AND user = 'root'; quit; 5. Modify the configuration file /etc/my.cnf to delete the previously added line skip-grant-tables and restart MySQL. This step is very important and failure to perform it may lead to serious safety issues. 6. Log in using the password you just set. mysql -u root -p 7.MySQL will force you to change your password, and it cannot be a simple rule password. ALTER USER root@localhost IDENTIFIED BY 'your-new-password'; The steps may seem a bit cumbersome, and I haven't thought of any other solution yet, so just use it this way for now. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: jQuery treeview tree structure application
>>: Detailed explanation of software configuration using docker-compose in linux
Preface In current JavaScript, there is no concep...
Table of contents 1. The difference between funct...
Copy code The code is as follows: <frameset co...
MySQL installation instructions MySQL is a relati...
What is DNS The full name of DNS is Domain Name S...
First, attach the code below the effect diagram &...
introduction Have you ever encountered a situatio...
1. Use floating method Effect picture: The code i...
This article will introduce a very interesting at...
1. Check the PHP version after entering the termi...
CSS Selectors Setting style on the html tag can s...
When we work in a terminal or console, we may not...
Socket option function Function: Methods used to ...
WebRTC, which stands for Web Real-Time Communicat...
PS: I use PHPStudy2016 here 1. Stop MySQL during ...