Internet of Things Province, National Competition Ubuntu18.04 offline installation MySQL + remote connection

Preface

Since the national competition environment does not have an external network, the MySQL installation in the Ubuntu system is an offline installation. However, due to the many installation methods, and the official has never specified the installation method, there are arrangements for the 2021 national competition and the 2022 national competition, as well as for each provincial competition. Later, this article was specially prepared. Note: This article mainly explains the installation method for the 2021 Shandong Provincial Competition . During the period, the installation methods and precautions for the two national competitions will be added. My operations were all completed on the Win11 operating system.

Topic display

1. Open the Ubuntu system

Find Oracle VM VirtualBox on the desktop. After entering, the Ubuntu system will be loaded under normal circumstances. If there is no system, the player will load it on the D drive under normal circumstances.

 

 Start Ubuntu. If you use the competition Ubuntu system for the first time, an error may appear. At this time, you need to enter the settings interface and change the connection method to a bridged network card before you can enter normally.

After entering normally, create the mysql folder according to the topic

 It is best to set the permissions of the folder so that everyone can fully operate it to avoid unnecessary trouble.

2. Import the MySQL offline installation package

Ubuntu offline installation package password 1234

According to the title, transfer the MySQL installation package through xftp, then find the installation package and install it.

Because xftp officially installs the latest version for users every other year, the installation result of the installation package set to be longer than one year is:

No matter how you click OK at this time, the pop-up still says "You have installed the latest version of Xftp 7 on your system."

If this situation occurs during the game, you only need to adjust the system time to one year ago to resolve the error.

At this time, reopen the software and it will start normally. Enter your own IP and user password.

Under normal circumstances, the interface will be entered, but port 22 was closed during the competition in the 2022 national competition environment. If the port is not opened, the normal connection will not be possible! At this time, you need to enter the Ubuntu system and enter the command sudo ufw allow 22

At this point, you will be able to enter the interface normally, find the correct path, and click Transfer.

Under normal circumstances, the transmission will be successful

At this point, return to Ubuntu to check whether the transfer is successful. 

Due to compatibility issues, file names with Chinese characters will not be displayed properly. 

The above method is the xftp transmission method. I usually use the Windows DOS interface for remote transmission. First, for convenience, move the files to the C drive.

At this time, return to the DOS interface, use the cd .. command to return to the C drive, and enter the command at this time

scp Ubuntu18.04 offline installation mysql5.7.tar.gz [email protected]:/home/newland/mysql

At this point, return to the Ubuntu system to check whether the transfer is normal.

 

At this point, enter the Ubuntu system to decompress the file and enter the command tar -zxvf file name

Note: The 2022 National Competition ends with .zip. You need to enter the specified unzip file name to decompress it.

At this point enter the ./install.sh command

You will find a red error. According to the error content, you can find that the process is locked. At this time, you only need to delete the locked file. Now find the dpkg folder, find the lock and lock-frontend files, and delete these two folders.

 Enter the rm file command under root to delete

At this point, enter the command again to install.

 Note: The 2021 National Competition will be installed using docker. After decompressing the file, enter the docker-compose up -d command in the folder where docker.yml belongs to install it; there is no install.sh file for the 2022 National Competition, but it is marked To determine the installation sequence, you can directly install in the graphical interface in sequence, or enter dpkg -i file name to install in sequence.

When the installation is complete, the following prompt will appear

 At this time, enter the command sudo mysql -u root -p to enter the mysql interface normally.

3. MySQL remote connection

First create a user named root, @ followed by the restricted ip, % means any ip, identified means to confirm the identity, and 123456 is the password to confirm the identity. The general meaning is to create a root user that restricts all IPs, and the password to confirm the identity is 123456

create user 'root'@‘%' identified by '123456';

Grant permissions at this time, which roughly means granting all permissions to the root user.

Refresh permissions

At this point enter the Navicat software to test the connection.

If you find that you cannot connect to this IP, you need to return to the Ubuntu system to modify the configuration file.

Find the ip and change the ip to 0.0.0.0

First click the 'i' or 'a' key on the keyboard to enter the input mode, change it to 0.0.0.0, then press the Esc key to release it, enter ':' and enter wq to save and exit.

 Restart MySQL at this time

At this point, return again for testing, that is, the link is successful.

If Authentication plugin 'caching_sha2_password' cannot be loaded appears, return to Ubuntu and enter ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY'123456'; in mysql.

If an error occurs when connecting to the server remotely, check whether port 3306 is not open. Enter ufw allow 3306 in the Ubuntu terminal.

The above is all my deployment methods. If you encounter any questions or there are errors in the article, you can send a private message or comment.

Guess you like

Origin blog.csdn.net/weixin_57037287/article/details/127177006