The mysqli error was: Unknown database

為{幸葍}努か 提交于 2020-01-30 11:32:06

问题


I am importing a mysql database from the webserver to my local system for a migration from drupal 6 to drupal 8.

I did an Export with phpmyadmin on the server. Then I created the database locally also with phpmyadmin and imported my dump from the server via phpmyadmin's import function. Then I created the user with the setting of my drupal 6 configuration.

I can see the database in phpmyadmin if I connect with my local root user. I cannot connect with the user created from the settings ( lets call that the drupal_db_user) If I call the drupal site on my local apache ( apache & mysql server are running or my phpmyadmin would not work) I get the messeage from drupal: "The mysqli error was: Unknown database 'my_drupal_db'."

Via Mysqlworkbench I am also not able to conntect to the my_drupal_db with the drupal_db_user.

I use locally php 5.6 and mysql 5.6 on a ubuntu system.

Creating the user and db via mysql console also did not help.

Any clue what might be wrong here? I suspect it could be the password encryption, but I have no clue how to check / change that other than trying the two options phpmyadmin (version 4.6) is offering me.


回答1:


I guess you dont need to backup on your pc as the files that you exported from server is a backup on its own. Just download the sql file update to drupal 8 and finally import the file and you should have it installed.

Or simply try importing the exported file from server to another subdomain drupal 8 as a test. To check If it really works.




回答2:


Found the problem. after at least 3 hours poking around and cursing..... When I created the database locally I had by mistake an whitespace in front of the db name.

Which by the way was possible... I didn't know you could even create databases with whitespaces in the name.

What let me find the error was this post: https://drupal.stackexchange.com/questions/27050/fatal-error-pdoexception-sqlstate42000-1049-unknown-database and the hint with this query:

SELECT * FROM my_drupal_db.users

which of course failed and made me really question the database name.

Hope that helps someone else saving 3 hours!



来源:https://stackoverflow.com/questions/37055807/the-mysqli-error-was-unknown-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!