MYSQL virtual machine connection tutorial, mysql Virtual Machine tutorial
Record the results of a day:
After Ubuntu 16 is installed on the VM, apt-get update is stuck in forheader. Check that the ipv6 address is followed,
Use IPv4
If you only want apt-get to use IPv4 or IPv6 at one time, follow these steps. This function is available in apt-get 0.9.7.9 ~ Exp1 is available. First, run the following command to confirm that the apt-get version is later than 0.9.7.9 ~ Exp1:
Apt-get-version
The result is similar:
Apt 1.0.1ubuntu2 for amd64 compiled on Oct 28 2014 20:55:14
After verifying the version, you can use the following command to force IPv4:
Apt-get-o Acquire: ForceIPv4 = true update
Or IPv6:
Apt-get-o Acquire: ForceIPv6 = true update
This will resolve the URL in sources. list to IPv4 only and update the repository.
Persistent options
To make the settings persistent, create the 99force-ipv4 file under/etc/apt. conf. d.
Sudoedit/etc/apt. conf. d/99force-ipv4
Then, because the built-in software source is slow,
Modify sourceList
#/Etc/apt/sources. list # Replace the following content with the source file (note that you should select the appropriate version of your system on the Tsinghua University website) # comment out the source code image by default to improve the apt update speed, uncomment deb if necessary https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-security main restricted universe multiverse # pre-release software source, not recommended # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Xenial-proposed main restricted universe multiverse
Install MYSQL
Apt-get install may be dependent on other packages but cannot be automatically downloaded;
sudo apt-get install mysql-server mysql-client
Run apt-get update first.
After installation, NAVICAT cannot be used for connection in windows.
Step 3:
1. manually add users who can remotely access the database.
Method 1. log on to mysql locally and change the "host" entry in the "user" table in the "mysql" database, change "localhost" to "%" # mysql-u root-proot mysql> use mysql; mysql> update user set host = '%' where user = 'root '; mysql> select host, user from user; Method 2: directly authorize (recommended) use the root user on any host, password: youpassword (your root password) to connect to the mysql server: # mysql-u root-proot mysql> grant all privileges on *. * TO 'root' @ '%' identified by 'youpassword' with grant option; after the operation, remember TO execute the following command TO refresh the permission FLUSH PRIVILEGES
2. view the Firewall
Ufw
3. Modify the mysql configuration (stuck here for three hours, pitfall)
By default, mysql only allows local access.
Mysql in the/etc/mysql directory. cnf is the configuration file. We can see that two configuration files are introduced below. We need to comment out bind = 127.0.0.1 of the second configuration file and then remotely access it.