cannot connect to database server

Ошибка означает, что PHP-скрипт не смог подключиться к серверу MySQL, так как сервер перегружен или недоступен. Например, эта проблема может возникнуть, если администратор делает какие-то изменения на сервере MySQL. Также проблема возникает, если неправильно указаны данные для доступа к базе данных.

Проверьте данные для доступа к серверу MySQL. Откройте файл config.local.php в корневой директории с установленным CS-Cart/Multi-Vendor и проверьте значения следующих переменных:

db_host — местонахождение базы данных. Обычно база данных и магазин находятся на одном сервере, и тогда строка будет выглядеть так:

db_name — имя базы данных;

db_user — имя пользователя базы данных;

db_password — пароль пользователя базы данных.

General pointers would be appreciated — it’s likely I’m misunderstanding the mechanisms involved in a remote connection through ssh. I can use ssh to connect remotely, and then, through the CLI, connect to MySQL. I’d like to do that with MySQL Workbench.

I don’t understand the parameters to send:

From the CLI, ssh thufir@192.168.1.2 works without a password because the key authenticates. Once I’m logged in, I can then access the database as so:

(ViciDial redux ships without password the the MySQL root user; for the time being I’ll leave that as is.)

I’ve tried a few different users; I’ve enabled and disabled «use old authentication protocol» without result.

To go through the specifics:

old authentication method? Sounds suspect..

ssh username: the name I login with over ssh, «thufir» as in «thufir@192.168.1.2»

ssh password: there’s no password during ssh, it uses a key.

ssh key file: well, I just typed in the path manually

the other connection parameters are those MySQL connection paramters which I use once I’m logged in through ssh?

The full error from Workbench is:

Starting with #3, I don’t want (MySQL) root to connect from any address except localhost. isn’t the point of using ssh that I first login as a user, and then workbench, only after logging in to the system, then initiates a database connection?

so. port 3306 is closed. But that’s ok, because ssh uses port 22..

can connect once connected via ssh.

connects me fine to tleilax..admittedly, I’m not quite sure what those parameters mean, I’ll have to look them up.

Could you help me solve this problem ?

When I try to click «query database» under database menu in Mysql workbench. it gives me an error:

15 Answers 15

The issue is likely due to socket authentication being enabled for the root user by default when no password is set, during the upgrade to ubuntu 16.04.

The solution is to revert back to native password authentication. You can do this by logging in to MySQL using socket authentication by doing:

which will revert back to the native (old default) password authentication.

Now use password as the password whenever required by MySQL.

Try opening services.msc from the start menu search box and try manually starting the MySQL service.

It looks like there are a lot of causes of this error.

In my case, the cause was that my server was configured to only accept connections from localhost. I fixed it by following this article: How Do I Enable Remote Access To MySQL Database Server?. My my.cnf file had no skip-networking line, so I just changed the line

This allows connections from any IP, not just 127.0.0.1.

Then, I created a MySql user that could connect from my client machine by running the following terminal commands:

where 1.2.3.4 is the IP of the client you are trying to connect from. If you really have trouble, you can use ‘%’ instead of ‘1.2.3.4’ to allow the user to connect from any IP.

For a fairly extensive list, see Causes of Access-Denied Errors.

Did you try to determine if this is a problem with Workbench or a general connection problem? Try this:

  1. Open a terminal
  2. Type mysql -u root -p -h 127.0.0.1 -P 3306
  3. If you can connect successfully you will see a mysql prompt after you type your password (type quit and Enter there to exit).

Report back how this worked.

]# mysql -u root -p -h 127.0.0.1 -P 3306 Enter password: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES) [root@localhost

]# mysql -u admin -p -h 127.0.0.1 -P 3306 Enter password: ERROR 1045 (28000): Access denied for user ‘admin’@’localhost’ (using password: YES) [root@localhost

I had a similar issue on Mac OS and I was able to fix it this way:

From the terminal, run:

Then, I was asked to enter the password. I just pressed enter since no password was setup.

I got a message as follows:

Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 181. Server version: 8.0.11 Homebrew.

If you succeeded to log into mysql>, run the following command:

You should get a message like this:

Query OK, 0 rows affected (0.19 sec)

Now, your password is «password» and your username is «root«.

I had to start Workbench as Administrator. Apparently it didn’t have the required permissions to connect to my localhost database server process.

Right-click the Workbench shortcut and select Run as Administrator . In the shortcut’s Properties window, you can click on «Advanced» and tick the box next to «Run as Administrator» to always run the Workbench with Admin privileges.

Run the ALTER USER command. Be sure to change password to a strong password of your choosing.

sudo mysql # Login to mysql`

Run the below command

Now you can access it by using the new password.

I struggled with this problem for awhile and did several reinstalls of MySQL before discovering this.

I know that MySQL server was running OK because I could access all my DB’s using the command line.

Hope this works for you.

In MySQL Workbench (5.2.47 CE)

click Mange Server Instances (bottom right corner)

click Connection

in the Connection box select:

Local Instance ($ServerName) — root@127.0.0.1:3306 ‘

click Edit Selected.

under Parameters, Hostname change localhost or 127.0.0.1 to your NetBIOS name

click Test Connection

If this works for you, great. If not change the hostname back to what it was.

The error occur because the mysql server is not starting on your computer. You should start it manually. Do following steps:

Download and install wamp server according to your bit version(32bit or 64bit) in your computer(http://wampserver-64bit.en.softonic.com/) this link allows you to download wamp server for 64bit.

As soon as you install it you can double click and run it..(you can see a icon in the right hand of the taskbar.It may be hidden .so you can click the arrow which show you the hide apps runing).So click the icon and go to Mysql

Then go to Service and there you can find Start/Resume Services click on it..

And now it is done.Open mysql workbench and see.It will work..

To be up to date for upper versions and later visitors :

Currently I’m working on a win7 64bit having different tools on it including python 2.7.4 as a prerequisite for google android .

When I upgraded from WB 6.0.8-win32 to upper versions to have 64bit performance I had some problems for example on 6.3.5-winx64 I had a bug in the details view of tables (disordered view) caused me to downgrade to 6.2.5-winx64.

As a GUI user, easy forward/backward engineering and db server relative items were working well but when we try to Database>Connect to Database we will have Not connected and will have python error if we try to execute a query however the DB server service is absolutely ran and is working well and this problem is not from the server and is from workbench. To resolve it we must use Query>Reconnect to Server to choose the DB connection explicitly and then almost everything looks good (this may be due to my multiple db connections and I couldn’t find some solution to define the default db connection in workbench).

As a note : because I’m using latest Xampp version (even in linux addictively 🙂 ), recently Xampp uses mariadb 10 instead of mysql 5.x causes the mysql file version to be 10 may cause some problems such as forward engineering of procedures which can be resolved via mysql_upgrade.exe but still when we try to check a db connection wb will inform about the wrong version however it is not critical and works well.

Conclusion : Thus sometimes db connection problems in workbench may be due to itself and not server (if you don’t have other db connection relative problems).

Оцените статью