importing a database into phpmyadmin #1044 - Access denied for user - mysql

I have recently purchased web hosting service at godaddy. I have already completed my project and i used xampp. Now i want to import the database which i arleady have. I tried to do it in the normal way by clicking on import and choosing the file. But i'm getting this error
How can I fix this?

Many web hosts only give you access to one database. Your SQL file is trying to create a new database (with a line near the top like CREATE DATABASE `socialnew`... as you see in the error message).
The likely solution is to not create the database from your script. You can either edit the .sql file manually and remove the lines starting with CREATE DATABASE `socialnew`... and USE `socialnew`;, or, if your phpMyAdmin is pretty up-to-date, you could do the export again from your XAMPP and make sure the checkbox is not selected for "Add CREATE DATABASE / USE statement".
Then when doing the import, make sure you're selecting the Import tab from within the database you wish to import to.

You may also open the .sql file in an IDE and just delete the create command.Then, assuming you've navigated to the desired DB import section in phpMyAdmin, you can run the import with the modified file and you should be good to go.

Must Ensure that your User_Name, Password and Database name are correct. If you are Deal with database 'sampled' then type 'sampled' in query instead of 'db' also must ensure that you don't have to use quota(') in Statement. For More and Accurate Detail visit Following link: http://onephin.com/1044-access-denied-user-user_namelocalhost-database-database_name/

Export and import just tables of the database:
-> open the database in phpmyadmin
-> click to export
-> save the file (you don't have to change any settings)
-> open the database on new server
-> click to import
-> chose the file
-> click to "GO" and you are done...
It was working for me :-)

Related

Importing big sql file ends up with [ERROR_RDBMS] exit status 1

I'm trying to import a big sql file (around 10GB) in Google SQL. I have create my instance and had tried so far with MySQL 5.6 and MySQL 5.7 both getting the same issue when trying to import the database: [ERROR_RDBMS] exit status 1. I have tried the user interface method for import as well as the console one (gcloud sql import sql mydb gs://my-path/mydb.sql --database=mydb). Also tried to find more details in Log explorer, but there was no error or anything else be notices for the mysql.err log.
In the same time I manage to connect my MySQL Workbench to the instance and I could see that there where few database tables that were imported. The only import seems that crushed on importing one of the biggest tables which is around 5GB.
Can anyone suggest what might cause this error and how I can find more info about it. Thank you.
I didn't found how to see the error on google console but figure it our that I can import the database through the MySQL Workbench and there I got the full error. If any one know a way to do this on the google cloud I'll accept her/his answer.

importing csv to db2

I am trying to import a .csv file with 2 columns (...and just 3 rows...just for testing) using the query:
IMPORT FROM "C:\db2\dtest.csv" OF DEL INSERT INTO TEST_DATA.DTEST (CAR, NICKNAME)
I am getting this error:
SQL0104N: SQL0104N An unexpected token "IMPORT FROM "C:\db2\dtest.csv"
OF DEL" was found following "BEGIN-OF-STATEMENT". Expected tokens may
include: "". SQLSTATE=42601
If I'm just being stupid here please do tell me :)
The IMPORT is not SQL, it is a command. That means you must submit the IMPORT from the Db2 command window (CLP), or from a script, or from a stored procedure . You cannot submit it directly via SQL, unless you use the ADMIN_CMD stored procedure. See the documentation for details and examples. You would use the ADMIN_CMD if you normally interact with databases via a GUI tool.
Using the command line is best ONLY if you will regularly use batch commands, or write scripts in any scripting language - and you are competent at scripting and using command-lines. But this method has pre-requisites especially if the database is on a different hostname or a different Db2-instance than the one you are working with (i.e. the db is remote). For remote databases the database needs to be catalogued via db2 catalog tcpip node .... and db2 catalog database ... commands.
Additionally you must first connect to the database via db2 connect to .... You have to do this regardless of whether the database is local or remote. See docs for details. For local databases you just use db2 connect to dbname where dbname must be your database name.
Using the ADMIN_CMD stored procedure if often easier for new users who are not familiar with using command line tools.
To use the Db2 command window (CLP), you can either use it interactively, or you can use your operating-system shell. On Windows use db2cwadmin.bat to open such a window (for batch or command usage), or run the db2.exe to enter interactive mode. You can then in interactive mode run your import command.
This happened to me when i was importing data from CSV to Sql DB
--In my case this happened because of incorrectly formatted CSV File.
When extracting data from CSV file have a look at the preview of data which will give an idea of where the data is wrong.
It may be because of different characters like , ' ' etc..
--t

Import MySQL database with phpMyAdmin

I'm getting an error:
#1044 - Access denied for user 'host_adminman'#'localhost' to database 'testdb4'
I thing that it should be denied, since the user/pass combo for MySQL 5.6 that was used on my PC while developing DB do not match ones I got from host. I've found explanation from HostGator that:
"The problem here is your import file contains an SQL query that attempts to create a database for the wrong username. Notice the user2 in 'user2_wrdp9' does not match the username1 in 'username1'#'localhost'. Someone must edit the import file and change the old user2 to your new username1.
So, how do I do that?
I have MySQL Workbench installed. Added, the same username as on the host, gave it all privileges to 'testdb4', exported database in a SQL file, but I still get this error when I try to import it on the host.
Did somebody use phpmyadmin to create this import file?
If so, can you get them to do it again?
If so, can they use the "custom-display all possible options" item in the phpmyadmin export panel? That will allow them to uncheck the "Add CREATE DATABASE / USE statement" and redo the export. That should get rid of your problem with the import.
If you can't get the export file remade, you can use a simple text editor (for example, the notepad program on Windows) to fix up the import SQL file.
If the filename ends in .zip or .gz or some such, you need to uncompress it first.
Then open it up in the text editor. Right near the beginning of the file you'll find lines like these:
--
-- Database: `blah_blah`
--
CREATE DATABASE IF NOT EXISTS `blah_blah` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `blah_blah`;
Delete them and save the file. Then try importing it again.

Easy PHP and mysql ..php cannot see database on local pc (all works on server)

I have a website written in php and mysql (written by someone else) and I need to alter it- just for your interest it is bridgetjonesart.co.uk. So I thought I would download it to my desktop pc and use easy php and mysql locally to make changes then upload it again.
I seem to have downloaded everything okay. I first just tried to run existing php using Easy Php and got
Warning: mysql_connect(): Access denied for user 'runningc'#'localhost' (using password: YES) in C:\Program Files (x86)\EasyPHP-12.1\www\backup from runningc\public_html\bridgetjonesart.co.uk\mysqlLogin\mysql_connect.php on line 6
Could not connect to database. Error
I have the sql database as a file 'runningc_bjart.sql' in the root directory but I think the php cant see it so I tried to use easy php administration, phpmyadmin and thought perhaps I should import the 'runningc_bjart.sql' file. So I tried and got an error message ...
Error
SQL query:
--
-- Table structure for table `Blog`
--
DROP TABLE IF EXISTS `Blog` ;
MySQL said: Documentation
#1046 - No database selected
I am not sure what to try next, any help would be really appreciated.
Thank you. Bridget
The error messages are VERY clear.
Error #1: You're using the incorrect credentials, or have forgotten to grant rights on your database to the credentials you're using.
Error #2: You've forgotten to set a default database, so MySQL has no idea which database it should be looking in for the table you're trying to drop.
e.g. you need
mysql_select_db('mydatabase');
or change your DROP query to be
DROP TABLE mydatabase.Blog;
With phpmyadmin, create a new database named runningc_bjart and import the file there. Then search in your project for a config file where the db password is set and change it with your local mysql password

phpmyadmin enable drop database statement

I was alerted by my hosting provider that I exceed my 1000 table limit. I have a lot of databases and would like to delete more at once. Unfortunaltley they don't have a multiselect feature so I decided to use a query in phpmyadmin.
When I try something like DROP database some_name I get DROP DATABASE statements are disables
Does anyone know if it's possible to enable them or a different way to delete multiple databases?
It looks like there is a phpMyAdmin setting that you need to edit in config.inc.php.
boolean $cfg['AllowUserDropDatabase'] (line 503)
show a 'Drop database' link to normal users
Yes, you can do it with the following steps:
Go to wamp/apps/phpmyadmin3.5.1/libraries
Open the file called "config.default.php"
Go to line 653 and change $cfg['AllowUserDropDatabase'] = false; to true
Restart the server to see the changes
For Windows XP users: if the effect is not reflected, exit WAMP through the quick launch icon and try restarting it.
Go to -> your_drive/xampp/PhpMyAdmin/libraries/ (Windows with XAMPP)
or
/usr/share/phpmyadmin/libraries/ (Linux with PHP/Apache/MySQL/PhpMyAdmin)
Open a file name config.default.php
Find $cfg['AllowUserDropDatabase']
You will find the value is False. Change it to True.
Linux restart apache2 in terminal /etc/init.d/apache2 restart (Linux) or XAMPP Control Panel restart Mysql
Without touching any config files
If you have your phpmyadmin open, on the left side you'll see a database icon right next to your home icon( if you mouse over it - 'query window' title will pop up ), click on it and the window showed will allow you to enter the 'drop query' without touching any config files( at least i had no problems, hope it will help ).
you will need to update file config.default generally phpmyadmin's libraries folder
line 653 (may very depending on version)
$cfg['AllowUserDropDatabase'] = true;
Xampp window
Method 1
Open Xampp
apache -> Config -> phpMyAdmin(config.inc.php) or config.inc.php
Add $cfg['AllowUserDropDatabase'] = true;
Adding line in config.inc.php
Method 2
Open C:\xampp\phpMyAdmin\config.inc.php
Add $cfg['AllowUserDropDatabase'] = true;
PhpMyAdmin throws the error “DROP DATABASE” statement is disabled”. “DROP” tab is missing on the PhpMyadmin Home page. To Enable the above tab in PhpMyAdmin follows the below procedure.
Go to XAMPP directory—–>PhpMyAdmin—–>libraries/ folder.
Open/Edit the file with the name “config.default.php”
Find $cfg['AllowUserDropDatabase']
You will find it’s value is ‘False’, Make it “True” and you’re done.
Refresh PhpMyAdmin Page or Restart MySql server and then open PhpMyAdmin.
I was able to do without modifying any of the above mentioned files.
Step 1
click on the database icon next to home icon
Step 2
on the right side of the screen select the operations tab
Step 3
Select the drop the database option and it should work[for me it worked even with the tables containing data
Drop the database and create a new one. To do so, go to phpmyadmin and select the database over the left panel. Then Go to 'Operations' tab on the head. Find the option to Remove Database at middle right. Click on DROP DATABASE and way to go...
did you try deleting the database by logging in to mySQL using SSH if you have not already..
sudo mysql -u yourmysqlusername -p (enter the password
when prompted.)
mysql> SHOW DATABASES; (find your database)
mysql> USE YOURDATABSETODROP; (CHANGE THE DATABASE)
mysql> DROP DATABASE YOURDATABSETODROP; (and you are done.)
Sometimes PhpMyAdmin throws very unusual error: ““DROP DATABASE” statement is disabled”.
In this situation the “DROP” tab can not be seen in PhpMyAdmin home page. You can get rid of this problem by doing the following process.
Go to -> your_drive/xampp/PhpMyAdmin/libraries/
Open a file name “config.default.php“
Find $cfg['AllowUserDropDatabase'] = false; and
convert it to like: $cfg['AllowUserDropDatabase'] = true;
Stop mysql server and Start again.
:) you can now able to drop the database.
Yes, you can do it with the following steps:
1. Go to wamp/apps/phpmyadmin3.5.1/libraries
2. Open the file called "config.default.php"
3. Go to line 653 and change $cfg['AllowUserDropDatabase'] = false; to true
4.Restart the server to see the changes
Restart the wamp ...Close wamp server and open again. :)
Enjoy!
If this happened on a MAC, the chances are you are not running within an administrator's account; you don't have permission to delete the directory.
In your finder menu bar click "go" and type the following: usr/local/mysql/data
Select/delete the directory with the same database you want to drop - you will likely get the dialog asking for the admin username and password to continue.
After you enter the admin credentials, the directory will be gone. Restart your session with the database and you will be good to go.
Hope this helps
if you are using version 4+ then you can simply drop a database just following these steps:
go to mysql admin
click database option (right side of your databases)
here you will get all the databases you have and now click the checkbox at the left side of the databases you want to delete
just the bottom of these databases you can see the option "Drop" so click the drop to delete the database permanently
I had to use another icon in CPanel (Databases section / MySqlDatabases) instead of (Databases Section / phpMyAdmin).
(... since my shared web-host provider disables the DROP DATABASE command, and initially limits access to command line and config files.)
select the database in phpadmin
click the operations button
show the remove database section
click the Drop the database(DROP). It show the alert box.
click OK.
I had problems with most of these approaches.
My installation is hosted so I don't have access to the PHP config files and the PHPMyAdmin interface is not displaying the "Remove Database" section mentioned above (under the Operations Tab). The icon in the corner didn't work either.
What I realised you can do is create a stored procedure to delete your table.
Go to "Routines", "Add Routine" and create a stored procedure with the single line:
DROP DATABASE databasename
When that's created you can execute it and the database will get deleted.
Go to \wamp\apps\phpmyadmin4.1.14\libraries
Open the file called "config.default.php"
Go to line 653 and change $cfg['AllowUserDropDatabase'] = false; to true
Restart the server to see the changes
I noticed the same problem when I was trying to drop a database (5.0.2 is the version of PhpMyAdmin I am using). In my case, there is no $cfg['AllowUserDropDatabase'] variable in the config.inc.php file and the default config file libraries/config.default.php has it false by default.
If you want to allow dropping a database temporarily, I would recommend just adding a $cfg['AllowUserDropDatabase'] = true; line in the end of the config.inc.php file (or change the false value to true instead if it's already there) instead of modifying the default value in libraries/config.default.php that some answers here recommend because as the documentation says, "the file is not intended for changes". After doing your thing, just delete the line altogether or set it back to false again.
Go to the left sidebar of phpmyadmin where there is a listing of your databases and select the specific database that you want to delete.
Having done that under the menu bar where there are several options such as query, sql, operations, etc choose structure.
When you do that it will give you a listing of all the tables of the DB and right below the tables there is a checkbox choose check all and on the dropdown after that choose drop.