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

JavaScript counts the number of times a character appears

This article example shares the specific code of ...

MySQL 8.0.12 winx64 detailed installation tutorial

This article shares the installation tutorial of ...

Install JDK8 in rpm mode on CentOS7

After CentOS 7 is successfully installed, OpenJDK...

Overview of the Differences between Linux TTY/PTS

When we type a letter on the keyboard, how is it ...

How many ports can a Linux server open at most?

Table of contents Port-related concepts: Relation...

Use of Linux telnet command

1. Introduction The telnet command is used to log...

Tutorial on installing MySQL with Docker and implementing remote connection

Pull the image docker pull mysql View the complet...

Summary of relevant knowledge points of ajax in jQuery

Preface Students who learn JavaScript know that A...

Detailed example of database operation object model in Spring jdbc

Detailed example of database operation object mod...

How to implement the @person function through Vue

This article uses vue, and adds mouse click event...

Introduction to fuzzy query method using instr in mysql

Using the internal function instr in MySQL can re...

Summary of some common uses of refs in React

Table of contents What are Refs 1. String type Re...

Nginx try_files directive usage examples

Nginx's configuration syntax is flexible and ...

How to clear mysql registry

Specific method: 1. Press [ win+r ] to open the r...