简体   繁体   中英

How to connect to SQLYog localhost or otherwise

I am new to working with servers, and am not able to use SQLYog because it is not able to connect to any server. When I try to use the default values to connect to MySQL (localhost, root, port 3306), I get "Error No. 2003: Can't connect to MySQL server on 'localhost' (0).

Is there something I am missing or that I have to correct? I am just trying to create a database.

SQLyog is just one way to connect to a MySQL database and interact with it. Other popular methods include MySQL Workbench , Navicat , phpMyAdmin , and others.

Before you can use any of these, you have to first make sure your MySQL server is running and accepting connections. You didn't mention (or tag) whether you are running MySQL on your local machine, or what operating system you are using.

A couple of the most common development environments are LAMP or WAMP, for "Linux, Apache, MySQL, php" or "Windows, Apache, MySQL, php" respectively. Since you tagged your question php , I'll assume one of these is appropriate. (For example you're using SQLyog on Windows but your MySQL server is on Linux.) (I'll presume Ubuntu for Linux examples.)

On the machine you've installed MySQL (along with any other components), you should be able to determine its running state by looking at your process list ( ps aux in Ubuntu, tasklist or Task Manager (GUI) in Windows).

You're looking for mysqld (Linux) or mysqld.exe (Windows). If the process isn't running, you need to start it ( Linux / Windows ). If you're using WampServer (a popular Windows all-in-one package), for example, you can also look in your Windows Services for "wampmysqld" or "wampmysqld64" and start the service there.

If you can't get the process to start, you may have a configuration error. If the process is running, you may need to check the configuration any way to determine what port it is running on, if it's not the standard 3306.

The configuration file name and location can vary by system and package, but generally it will be called "my.cnf" (Linux) or "my.ini" (Windows). Check your documentation for help on the specific path.

Once you've got the service running, you should be able to connect!

SQLyog连接对话框

This is the default SQLyog connection dialog (at least in my slightly older version). The defaults assume you are running your MySQL server on your local machine (localhost), that you have a user "root" with no password, and the default port 3306 is used.

You'll need to change any of this information that differs on your particular installation.

Be aware that if you're trying to connect to an instance of MySQL on another machine, a firewall may be blocking a port.

These steps should hopefully get you on the right track.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM