Detailed explanation of accessing MySQL database in Linux virtual machine under Windows environment

Detailed explanation of accessing MySQL database in Linux virtual machine under Windows environment

Linux virtual machine: VMware + Ubuntu 16.04.4

Windows native: Navicat for MySQL

1. Download and install MySQL in the virtual machine

To download and install VMware and Ubuntu 16.04.4, please search on Baidu. This article assumes that these have been installed.

In the virtual machine, press Ctrl+Alt+T to open a terminal, enter the command sudo apt-get install mysql-server mysql-client , and then follow the prompts.

Wait for the installation to complete. You can enter the command: whereis mysql to view the installation location of mysql

Start the database command: service mysql start Close the database command: service mysql stop Restart the database command: service mysql restart

Log in to the database: mysql -u root -p

Authorize a new user (so that you don't need to log in to the database as root)

mysql>grant all privileges on . to “new user name”@"%" identified by “new user password” with grant option;

Changes take effect:

myssql> flush privileges;

Exit the database:

mysql>exit;

However, the database cannot be connected using Navicat for MySQL at this time, and an error message will be reported. The error message is as follows (because the remote connection of the file has not been configured):

2. Modify the MySQL configuration file

Enter the command in the terminal: sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

After entering the password, the configuration file is opened. You need to comment out bind-address=127.0.0.1, which becomes #bind-address=127.0.0.1
(First click i to enter the edit mode, then click Esc to exit the edit mode, and type: wq on the last line to save and exit)

3. Download and install Navicat for MySQL on the Windows machine

Navicat for MySQL download and installation by yourself Baidu, basically all the way to next

4. Establish a connection

First, determine the virtual machine IP, enter the command in the terminal: ifconfig -a, where inet addr is the real IP, which needs to be entered in navicat for MySQL


Select Connection, click MySQL, and give the connection a name of your own.

If the above process does not work for you, please refer to a few points.

Note: 1. The network adapter in the virtual machine should be in bridge mode, which can be changed in Virtual Machine -> Settings -> Network Adapter 2. Pay attention to the settings of the virtual machine firewall

The above is the editor's introduction to how to access the MySQL database in the Linux virtual machine under the Windows environment. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Detailed method of packaging Python3 program under Windows and Linux
  • How to cross-compile Golang on Mac, Linux, and Windows
  • How to package Python 3 on Windows and Linux
  • Installation and verification of pytorch in linux or windows environment (solving runtimeerror problem)
  • Linux remote control windows system program (three methods)
  • Analysis of the method of uploading zip compressed packages under Windows to Linux system using compression
  • How to upload and download files between Linux server and Windows system
  • Remote Desktop Connection between Windows and Linux

<<:  Detailed explanation of how to use the Vue license plate input component

>>:  Detailed explanation of Zabbix installation and deployment practices

Recommend

Implementation of running SQL Server using Docker

Now .net core is cross-platform, and everyone is ...

WeChat applet implements the snake game

This article shares the specific code of the WeCh...

Mobile terminal adaptation makes px automatically converted to rem

Install postcss-pxtorem first: npm install postcs...

Sample code for CSS dynamic loading bar effect

Using the knowledge of CSS variables, I will dire...

Notes on using the blockquote tag

<br />Semanticization cannot be explained in...

MySQL5.7 single instance self-starting service configuration process

1.MySQL version [root@clq system]# mysql -v Welco...

You may not know these things about Mysql auto-increment id

Introduction: When using MySQL to create a table,...

Solve the problem of garbled data in MySQL database migration

Under the instructions of my leader, I took over ...

Two ways to introduce svg icons in Vue

How to introduce svg icons in Vue Method 1 of int...

Implementation of React virtual list

Table of contents 1. Background 2. What is a virt...