I am trying to restore database from db.sql dump
I have installed mysql (both client and server), when I have installed server I defined password for root user
and I am trying to restore DB with such command
nnn#nnn:~/prj/myprj$mysql -user=root -password=qwerty <db.sql
But I get the following error
ERROR 1045 (28000): Access denied for user 'ser=root'#'localhost' (using password: YES)
I have just create this password so it could not be wrong. Perhaps something else wrong in syntax? (I am using ubuntu by the way)
You need double dashes in front of long option names like --user, with singe dash it is taken as short option -u and the rest is taken as user name ser=root
So it is either
mysql --user=root --password=qwerty db_name < db.sql
or with short options
mysql -uroot -pqwerty db_name < db.sql
Related
I am running an AWS Ubuntu Instance.
I have installed Apache2, MySQL, PHP and phpmyadmin.
Now I am connected to the AWS instance through SSH, but I want to execute some MySQL commands but I am not able to enter the mysql mode.
After executing the command sudo mysql, I am getting an error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Executing the command mysql, I am getting the error:
ERROR 1045 (28000): Access denied for user 'ubuntu'#'localhost' (using password: NO)
I was able to enter the mysql mode, may be I have changed something during the installation of phpmyadmin, but I am not sure.
I need to enter the mysql mode again.
Apache, MySQL databases and phpmyadmin are working fine.
What should I do to be able to enter the mysql mode to execute some MySQL commands?
EDIT
I am able to execute MySQL command directly using the SQL tab in phpmyadmin, as I have done so far, but I would appreciate a solution to my issue.
This should do the trick:
$ mysql -u <username> -p<password> -h localhost
Where both:
<username> and <password> are the credentials you use to connect to the database via phpMyAdmin.
Note: that there is no space between -p and the actual password.
Since a few hours I'm trying to connect to a local sql environment. It works in one second with MySQL Workbench, but from the commandline MySQL is not very verbose :)
mysql -u root -p root --host=127.0.0.1 --port=10011 -password'root'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Somewhere they report to use -u, while somewhere else they suggest --u
How do I find out if mysql is able to reach the server?
What else can I do for troubleshooting?
MySQL command line is a mess, the solution was
mysql -uroot -h127.0.0.1 --port=10011 -proot
Some with -- like port and some with - like p, and with no space.
I am trying to connect Zapier to my Database. Zapier has very limited support for this and seem to be going round in circles.
I need to GRANT SELECT to a user on my database with this code;
GRANT SELECT ON my-database-here.my-table-here TO 'user-here'#'ip-address-here' IDENTIFIED BY 'my-password-here';
The error i receive is;
#1044 - Access denied for user 'xxx'#'localhost' to database 'xxxx'
The user has ALL PRIVILEGES but can't seem to get it to work. Any help here could be greatly received.
Thanks
You may need to set up a root account for your MySQL database:
In the terminal type:mysqladmin -u root password 'root password goes here'
And then to invoke the MySQL client:mysql -h localhost -u root -p
you have 2 issues:
1 => mysql -uroot -p should be typed in bash (also known as your terminal) not in MySQL
command-line. You fix this error by typing.
exit
in your MySQL command-line. Now you are back in your bash/terminal command-line.
You have a syntax error:
mysql -uroot -p;
the semicolon in front of -p needs to go. The correct syntax is:
mysql -uroot -p
type the correct syntax in your bash commandline. Enter a password if you have one set up; else just hit the enter button. You should get a response that is similar to this:
I have taken the the following steps to transfer my sql database but yet I receive an error on the importing of the database onto the new server. It does not seem to recognize my username or password.
I think the problem is being caused by phpMyAdmin privilege settings. I am transferring my sql file from a server that runs phpMyAdmin (hostgator) to an unmanaged web server.
Here are the steps I took
mysqldump -u root_wrdp1 -p --opt root_wrdp1 > root_wrdp1.sql
Enter password:
I then scp'd the sql file to my new web server (that does not run phpMyAdmin).
scp rbl91_wrdp1.sql root#ip.of.the.server:~/
Then I did the updating of the database on the web server without phpmyadmin...
root#www:~# mysql -u root_wrdp1 -p root_wrdp1 < ~/root_wrdp1.sql
Enter password:
ERROR 1045 (28000): Access denied for user 'root_wprd1'#'localhost' (using password: YES)
The support by the site offered this advice but I have no idea how to implement the steps.
It's possible you have to review the authorization locations, such as the source location (IP) of the remote side.
Using phpMyAdmin i believe the page is Priviliages , and you will also
need to flush them after changing.
Thanks Support
It's a simple authentication problem. Most likely the "root_wrp1" account or password are set up incorrectly on the destination machine. You can check it just by trying to log in without importing the dump file:
$ mysql -u root_wrdp1 -p root_wrdp1
The account and password need to be set up and have adequate permissions to the database before you can restore the dump file.
I have been searching for a while to find a good answer to my problem.
I have a new server where I would like to run a script in .php which uses a database to store some data. What I have done so far is:
Place the .php file in the server with the help of Putty.
Create a database in phpmyadmin, export it and place it in the same folder of my project in putty.
Run php5 crawl.php > logfile.log 2&>1&
but it doesn't update the database.
I am little bit confused with the steps I have to make in order to make it work. I have been reading also this article http://www.aspkin.com/using-putty-to-import-a-database/ but when I run the
mysql -u dbusername -p databasename < backupname.sql
I get this error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Any idea what I might be doing wrong?
if it's a local machine you may not have a password on it for root - so remove the -p tag.
Otherwise you want to specify the password in there with it, without a space, like so:
mysql -u dbusername -pYourPassword databasename < backupname.sql
zcat /path/to/file.sql.gz | mysql -uroot -p your_database