Error
SQL query:
CREATE DATABASE `information_schema` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
MySQL said:
View Full Image
#1044
- Access denied for user 'mydatabasenamehere'#'%' to database 'information_schema'
I've been told I don't have the right credentials/privileges. Ok. But where do I change them? The database was exported and then I changed the URL for my new site so I will have an exact copy of the original database. When I upload I get the above message.
I have access to both databases and both passwords. So where do I make the info right so I can import it without errors?
Your script is attempting to insert into system tables, which is forbidden:
Although you can select INFORMATION_SCHEMA as the default database with a USE statement, you can only read the contents of tables, not perform INSERT, UPDATE, or DELETE operations on them.
The question you should ask yourself is : why is your database backup containing these tables?
You should cut cut of information_schema, mysql and performance_schema from your dump before import.
May be it would be easier for you to make dump once again using mysqldump command utility and than restore it.
Another option it use grep, head, tail(*nix) or PowerShell (Windows) to extract database you need from your dump file.
Related
When I try to log into MySQL via command line, keeps saying "unknown database 'magento2'"
Any ideas why? Tried as my username and root, getting the same message. If I can't log into mysql, how could I create a database to begin with of that name? So confused.
You should separate between your database application and a logical database. MySQL server is your database application / server.
When you're logging on to MySQL, you're choosing which logical database you would like to work with. A logical database is actually a container of objects such as tables, triggers, views, etc.
So when you see the error unknown database X, it's because you installed the MySQL server, but didn't create the logical database.
To see a list of all logical databases in your server, login to MySQL and run the command show databases;
To create your database, run the command create database magento2;
Now when you login to that database, it should be there and you can start creating your tables and query data from them.
I had the same issue and found that the database name was set in a cnf file. Perhaps you have something similar.
Running WAMP localhost server With php 5.6.18 and MySQL 5.7.11 In project that im working on now i need to get some column data form information_schema.COLUMNS table, but information_schema DB is completely empty - 0 rows for every table in this DB For additional information - I have like 10 differnet DB on this MySQL, some are imported some are made from scratch in phpmyadmin.So im completely lost - tried to google but no luck.Maybe i miss something essential and trivial like some configuration of MySQL?
Execute this query:
mysql> SHOW GRANTS;
This will show you that either you are not logging in as the user you intend to use, or that this user lacks permissions on the tables in question.
In this case, the user may have no permissions at all. MySQL has a special permission called USAGE, which may seem slightly deceptively named if you aren't familiar with what it means. It means you can "use" the server -- that is, you can log in. But that is all it means. If you possess only the USAGE ON *.* privilege, this means you have permission to log in to the server, but no permissions on anything else.
The information_schema is integrated with the permissions system. You can't see information about database objects for which you don't have permissions. An empty information_schema.columns table suggests a permissions issue for the user you are using to connect to the server.
Sometimes this may be issue when you copy and paste the database's folders in mysql folder. Don't copy that way. The best way to export the databases using "export" command in "phpmyadmin" or use "mysqldump" command in mysql command line client to copy the data or export data from one to another.It will generate "yourdata.sql" file at the last , You can import that data using "export command in "phpmyadmin" . In your method is successful for "MyISAM" database driver in mysql. Modern mysql servers default database driver is "InnoDB" and it not success in when copy the database data folder on to another machine. If you have copy of previous copy of the databases from the old machine, try to export the "yourdata.sql" file using export method in "phpmyadmin" web interface.
I faced same problem when I transfer/shifted my mysql folder to other location.
And configured DB to point Mysql folder accordingly.
However, Information_schema was not getting updated though rest DB queries were running fine.I could't find proper solution but the way around was from mysql editor (like workbench) do inspect schema.
You will get an option in bottom to 'Information Outdated' and then click on Analyze table. You will find that Information_schema start calculating correct size and other details.
I have done an export of my database to an .sql file.
When I try and upload this to my new server it comes up as access denied for user 'username' # '%'
The original database is called 'originalUsername_databaseName' where as it appears that the new server requires the prefix 'admin_'
I am convinced that it is the database name that is causing the error. Is there a way to change this ?
Make sure that your sql file does not contain CREATE DATABASE and USE statements.
If it does, remove them.
Create database manually and import tables to it.
I'm moving a locally developed wordpress site to a client's server so I'm trying to export the local database and import it to the server. I exported the .sql file according to the instructions here http://codex.wordpress.org/Backing_Up_Your_Database but I keep getting this error when importing:
DROP TABLE IF EXISTS `wp_commentmeta` ;
MySQL said: Documentation
#1046 - No database selected
Any help very much appreciated. Thanks!
Like the two other answers say: I wasn't importing the backup file to a particular database. I had to create a new database and upload the file to that, and it worked fine.
Try sticking a use statement in front of it:
USE MyWordpressDBName;
DROP TABLE IF EXISTS `wp_commentmeta` ;
MySql Use Reference
You posted a link describing how to backup your database. But the problem you have is not with the backup but with the restore, so you should look at the instructions on how to restore your database.
Luckily that site also has instructions on how to restore a database from a backup (any guide which only tells you how to backup but not how to restore is IMHO a waste of time). Try following the instructions on this page:
http://codex.wordpress.org/Restoring_Your_Database_From_Backup
In particular notice this command near the end of the tutorial:
mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sql
The database name must be specified.
How do I do that? Is it possible? If it's not possible in phpmyadmin then can you tell me some alternative to achieve the same thing (putting a password to the mysql database that is being exported for backup)?
Passwords and permissions are stored in the database named mysql.
If you need to copy passwords you can dump and restore that database, but it will likely cause you problems, you can line by line restore from the database for tables that contain specific info.