The mysqli error was: Unknown database - mysql

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.

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.

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!

Related

Can't Connect MYSQL server to VScode & General SQL installation issues

How do I install MySQL Workbench properly? Can't connect to the SQLTools extension in VSCode.I'm new to the database scene, and can't seem to grasp how to create a successful SQL server that I can use to manipulate data. But nothing I'm doing seems to work.
Should I use Gitbash to access the terminal? I tried using my password to make a new query but it wouldn't work on the workbench. I don't know how to start the SQL server in addition to not knowing how to properly change the profile for the Workbench from a previous account. A new developer, such as myself, would appreciate any insight!
So that's really simple just install the mysql community server installer using this link https://dev.mysql.com/downloads/mysql/
Make sure to select the server only in the setup during installation if you are going to be using VS code as the client to manipulate sql queries
Then once that is done copy the bin path location from the mysql file directory (which is usually in the program files on your \C: drive on your computer) to the environment variables on your computer so that you can access mysql from the command line
Once that is done you can initialise a database from the normal command line but first type mysql -u root -p to start mysql in the command line
Then download the sql tools extension on vs code and create the database that wish

Exporting/importing mysql database with phpmyadmin

i'm migrating my website from a shared hosting to a VPS.
I setup all (files, mail, etc) and now i'm migrating database.
In phpmyadmin I export database to my pc, but when i trying to import database in new host (with phpmyadmin) i have only 12 tables of 47. I tried all avaible options, i tried with compression... I checked also table and these are not correctly populated. In the past i do this operation so many time without problem and i don't understand what can be.
Please can you help me?
I've found that sometimes PHPMyAdmin has issues with large files. This might be corrected by tweaking PHP's settings in php.ini (extend timeout, raise upload_max_filesize), but it may just be easier to upload the sql file to the server and import it via the command line.

cs cart - mySQL error on local host

I have an issues installing cs-cart on local enviroment, these are the errors:
MySQL settings are not valid
Could not connect to database
I've created a database named cart - and this is the name that I write in the MySQL database name from the installation wizard.
I've created an username and a password for this username - both are filled in correctly.
I have some when I open PhpMyAdmin -
A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is 4.4.14.1, released on 2015-09-08.
The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why.
Or alternately go to 'Operations' tab of any database to set it up there.
I use XAMPP.
Any thoughts on how can I solve this?
Did you check your config.local.php in the CS-Cart root dir? That file stores your MySQL database configuration.
I ran into the same issue here. I first tried adding my own username with no luck. Next I tried root#localhost after reading here on SF. Then finally, I tried with username as just: root and it worked. Install was not very intuitive. Anyways, I hope this helps someone else.

MySQL Not loading Database File from /usr/local/mysql/data

Hey Guys so the other day I was running a database schema in the mysql workbench on my mac. I had added tables populated the data and tried to run some big queries. The server died and now when I connect to my local host instance I cannot find my database. However I can still see my database file in /usr/local/mysql/data/
Can any one help me work out how to start mysql server again and get it to load in the file?
I just dont' understand why it can no longer see the schema..
Connecting as localhost, using root, both workbench and terminal can't see the file. However the file is here:
The file I want is AM_DUMPS
When I try and load it from SQL Workbench I get:
Check to see if the data directory is owned by MySQL or mysqld is not launched as the mysql user. It looks like something along those lines. You may have to adjust the permissions to make sure that mysql is the owner.

MYSQL - Connect MYSQL Workbench to a MYSQL server on localhost

I know the question I am about to ask is a very stupid once but I am new to MYSQL so please bear with me. Want I want to do is create a database on my local machine and also access/manipulate it from their. I thought MYSQL WB was the all in one tool to do this i.e it will also allow me to create a database and also make a MYSQL server from which to access it. But I came to know the Workbench is just a front end and you need to have a some kind of a seperate MYSQL server module for it to access.
The problem is I can't seem to find any link for a simple a server module on the MYSQL download site.
http://dev.mysql.com/downloads/ .
It has one Cluster Server but I don't think this is what I am looking for. If anyone could provide a link to the MYSQL server module using which I could connect MYSQL Workbench on my local host, and the steps to connect them that would be great.
The one your looking for is named MySQL Community Edition. The current version is 5.6.14. Just select your platform (mac, linux or windows) and follow the installation guide.
If you wish to have php/mysql then you can download xampp. It includes all the necessary tools. Or if you wish to install it separately then follow this for Windows,
http://dev.mysql.com/downloads/installer/