Java project online cloud server environment (3) - MySQL installation and configuration

Java project online cloud server environment (3) - MySQL installation and configuration

If you want to run your own project on a cloud server, you naturally need to use our mysql. Next, we will configure mysql in detail. The mysql version selected here is version 5.7. It is recommended to use Linux remote connection tools for operation. Window users can use Xshell, and macOS users can use terminal or iterm.

Detailed installation steps are as follows:

1. Check whether MySQL has been installed on the cloud server:

rpm -qa | grep mysql

If no content is displayed, it means that MySQL is not currently installed on the cloud server. If MySQL already exists on the cloud server, you can check whether the MySQL version meets the MySQL version required by your project. If not, you can completely delete MySQL, and then Install and configure the MySQL version required for your project. (Detailed steps to completely delete MySQL)

2. Download the MySQL repo source:

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

If an error is reported at this time: -bash:wget:未找到, then install the plug-in:

yum -y install wget

3. Install the mysql-community-release-el7-5.noarch.rpm package:

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

4. Install MySQL:

sudo yum install mysql-server

After downloading, enter: yEnter.

5. Reset MySQL password:

mysql -u root

If an error is reported at this time, it may be an access permission issue. Execute the following code:

chown root /var/lib/mysql/

6. Restart the MySQL service:

service mysqld restart

7. Execute the following commands in sequence to set the MySQL login password:

service mysqld restart
use mysql;
update user set password=password('123456') where user='root';
exit;

8. Restart the MySQL service:

service mysqld restart

9. Execute the following commands in sequence to set the root account and remote connection password:

mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";

10. Restart the MySQL service:

service mysqld restart

11. Turn off the firewall:

systemctl stop firewalld.service

At this point, MySQL on the cloud server is basically installed and configured.

Guess you like

Origin blog.csdn.net/Turniper/article/details/130377446