Assuming that the operating system is reinstalled, many local software may need to be re-installed, such as a database. However, assuming that we have some important software installed in the virtual machine, the database server can be backed up with the virtual machine before reinstalling the operating system. Once the operating system has been re-installed, the original database can still be used without any impact. However, assuming that the database is placed in the virtual machine, and our code development is generally on the actual Windows operating system, so there is a remote access to the database problem needs to be resolved.
Suppose you have a MySQL client installed on your local Windows system, you have MySQL server installed in the virtual machine unbunt, and now you want to access the MySQL servers inside the virtual machine from Windows clients.
Cmd
Mysql-h 192.168.9.9-u Root-p
ENTER PASSWORD:
The host IP address above is obtained by command ifconfig in Ubuntu.
However, by default, you do not have permission to access and you need to set up access permissions.
1, Cd/etc/mysql
2. Vim MY.CNF
3. Note the following line
4. Authorized users can connect remotely
Log on to the server side of the MySQL server, authorizing the root user to log on to the server from any host using password 123456.
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' 123456 ' with GRANT OPTION;
FLUSH Privileges
5. Restart the database
6. Execute on the Windows command line:
Mysql-h 192.168.9.9-u Root-p
SUCCESS
How do I remotely access a MySQL server within a virtual machine from a local?