MySQL database is widely used, especially for JAVA programmers. If you do not want to purchase a cloud database, you can install the MySQL database yourself. This article will introduce how to manually install MySQL version 5.7 in the CentOS 7.4 environment. 1. Install MySQL version: 5.7.25 2. Download address https://dev.mysql.com/downloads/mysql/5.7.html#downloads (As time goes by, please refer to the latest download address) 3. Use the wget command to download the relevant rpm files using the breakpoint transmission method (If the address is updated, please refer to the latest one) https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.25-1.el7.x86_64.rpm 4. After downloading, enter the corresponding directory and install it one by one (Note: There is a sequence for installation, just install it according to the download order above) rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm --force --nodeps (Note: --force --nodeps should be added appropriately according to the situation. Otherwise, some machines will experience installation errors.) 5. After the installation is complete, you first need to start the service. (Note that the service startup of CentOS7 and above is different from 6) systemctl start mysqld 6. Confirm that the installation is successful and create the initial root administrator password Modify /etc/my.cnf vi /etc/my.cnf Add in [mysqld] skip-grant-tables=1 This line of configuration tells mysqld not to verify the password when it starts 7. Restart mysqld service systemctl restart mysqld 8. Change the root login password 1) Log in to MySQL as root user mysql -uroot -p (press Enter directly, the password is empty) 2) Switch database use mysql; 3) Update the user table update user set authentication_string = password('your password'), password_expired = 'N', password_last_changed = now() where user = 'root'; 9. After the password is changed successfully, you can log in to MySQL and set up the client connection. (Note: If not set, the client Navicat cannot connect) GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION; FLUSH PRIVILEGES; Refresh table data flush privileges; quit \q 10. Edit the /etc/my.cnf file and delete the content of skip-grant-tables=1 vi /etc/my.cnf 11. Set the MySQL encoding to prevent garbled characters. Under [mysqld], add the encoding method character-set-server=utf8 (For details, please see the attached document) 12. Restart MySQL service systemctl restart mysqld Once you can connect to the database through client software, such as Navicat for MySQL, congratulations, the installation is successful. 【FAQ】 1. When installing under CentOS on a server in Hong Kong, the service cannot be started. [root@syne-hk-test mysql-5.7]# systemctl start mysqld Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. After in-depth investigation, the reason is that libaio.so.1 is not installed, so just install it. yum install libaio 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:
|
<<: Solve the problem of running node process in Linux system but unable to kill the process
>>: Summary of Linux date command knowledge points
<br />Based on the original width-and-height...
1 Download and start Tomcat Go to the official we...
Preface Bash has many important built-in commands...
What is a tree in web design? Simply put, clicking...
Table of contents Query cache optimization Overvi...
Table of contents Preface The difference between ...
Table of contents Requirement description: Requir...
vsftpd Overview vsftpd is the abbreviation of &qu...
Let's briefly sort out the configuration of s...
<br />I just saw the newly revamped ChinaUI....
Table of contents 1. Union Type 2. Crossover Type...
Preface The basic principle of MySQL master-slave...
I have seen a lot of MySQL-related syntax recentl...
When I was printing for a client recently, he aske...
The application scenario is: the iframe page has n...