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
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
##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)
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
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 -p6 .Third-party mysql database connection tools
There are many third-party database connection tools. Just set the relevant parameters as shown below7. After connecting, it will be a more user-friendly graphical interface.
More about mysql database tool navicat for mysql How to use it?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 Other notes1. 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. 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!