Home  >  Article  >  Database  >  How to log in to mysql and how to connect mysql database with cmd?

How to log in to mysql and how to connect mysql database with cmd?

黄舟
黄舟Original
2017-08-04 14:14:452772browse

Mysql is an open source database that anyone can download, install and use. So how to log in and connect to the mysql database after installing mysql? This experience mainly introduces several common methods

Several methods of connecting to mysql database

1. Mysql Command line connection

Generally for mysql that has just been installed, if you check to enable mysql lineclient. You can directly find Start---Program---mysql command line client as shown below

How to log in to mysql and how to connect mysql database with cmd?

2. After clicking the mysql command line, you will be prompted to enter the root password . After entering the correct root password, you can connect to the msyql database

How to log in to mysql and how to connect mysql database with cmd?

##3.2 How to connect to the database using the Cmd command line

If the mysql command line is not installed, we can find the path where mysqld is located (copy the path where mysqld.exe is located)

How to log in to mysql and how to connect mysql database with cmd?

4. Use cd to switch to the path of msyqld.exe, and then enter the mysql connection command as shown below

The format is:

Mysql -P port number -h mysql host name\ip -u root (user) -p

How to log in to mysql and how to connect mysql database with cmd?

5. If it is a command line It is the local machine where mysql is located

And use the default port 3306 to directly enter mysql -u root -p

How to log in to mysql and how to connect mysql database with cmd?

6 .Third-party mysql database connection tools

There are many third-party database connection tools. Just set the relevant parameters as shown below

How to log in to mysql and how to connect mysql database with cmd?

7. After connecting, it will be a more user-friendly graphical interface.

More about mysql database tool navicat for mysql How to use it?

How to log in to mysql and how to connect mysql database with cmd?

8. Other remote connection tools

Phpmyadmin is undoubtedly the most widely used graphical tool for PHP database management, because Involves different environments and paths. I won’t do detailed operations in this example

How to log in to mysql and how to connect mysql database with cmd?

Other notes

1. By default, mysql can only be logged in locally. If you need to log in externally, The network can connect normally.

You need to set open permissions in the mysql\user table. For example, hosts are the hosts that can be connected remotely.

How to log in to mysql and how to connect mysql database with cmd?

Explanation

In addition, there are PHP mysql connection parameters, mysql ODBC connection control to connect to mysql, etc. These are not professional, so there is no need to talk nonsense.

The above is the detailed content of How to log in to mysql and how to connect mysql database with cmd?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn