Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Linux Virtual Machine: VMware + ubuntu 16.04.4

Windows Native: Navicat for MySQL

1. Download and install MySQL in the virtual machine

VMware download installation and ubuntu16.04.4 download installation, please query Baidu, this article defaults to these have been installed.

Ctrl+Alt+T opens a terminal in the virtual machine, type sudo apt-get install mysql-server mysql-client, and follow the prompts.

Wait for the installation to complete, you can enter the command: whereis mysql View mysql installation location

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

Login database: mysql -u root -p

Authorize a new user (so you can log in to the database without root)

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

Entry into force of amendments:

myssql> flush privileges;

Exit database:

mysql>exit;

However, at this time the database can not be connected using Navicat for MySQL, an error will be reported, the error prompt is as follows (because there is no configuration file remote connection):

2. Modify mysql configuration file

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

After entering the password, the configuration file is opened. You need to comment bind-address=127.0.0.1, that is,#bind-address=127.0.0.1.

(First click i to enter edit mode, then click Esc to exit edit mode, type: wq in the last line to save and exit)

Navicat for MySQL

Navicat for MySQL download install your own Baidu, basically all the way next

4. Establish a connection

First determine the IP of the virtual machine. Enter the command ifconfig -a in the terminal, where inet addr is the real IP. In navicat for MySQL, you need to enter the IP.

Select the connection, click MySQL, and the connection name will start by itself.

If the above process, your operation is not successful, please refer to a few points.

Note: 1. To select bridge mode for network adapter in virtual machine, you can change it in Virtual Machine-Settings-Network Adapter. 2. Pay attention to the settings of virtual machine firewall.

The above is a small series to introduce you how to access the MySQL database in the Linux virtual machine in the Windows environment, I hope to help you, if you have any questions please give me a message, small series will reply to you in time. Thank you very much for your support!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report