473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

strange authentication trouble about mysqldump: error 1045

Hi all,

I got a quite strange problem when I tried to setup a database backup
shell. I put it this way:
"bin/mysqldump --opt --user=xxx --password=xxx DB > DB.bak"
However, error 1045 came to me to say "Access denied for user
'xxx'@'localhost' (using password: YES) when trying to connect".
None the less, I'm absolutely full of confidence on my correct username
and password, simply because if I do it this way:
"bin/mysqldump --opt --user=xxx DB > DB.bak",and input the same
password, everything goes well.
Could you please give me some suggestion concerning the issue? Any help
will be appreciated.

Zh.y

Jul 23 '05 #1
4 15561
21********@gmail.com wrote:
if I do it this way:
"bin/mysqldump --opt --user=xxx DB > DB.bak",and input the same
password, everything goes well.


I assume you mean "bin/mysqldump --opt --user=xxx -p DB > DB.bak" and
input the same password. (that is, using the -p option to ask for an
interactive prompt for password) Without using the -p flag, you're
asking to log into that database without using a password. MySQL
permits that mode of access to have different privileges than when you
provide a password for the same user name!

You can test access to a database given a username and password, using
the mysqlaccess command:

mysqlaccess --db=DB --user=xxx --password=yyy
--superuser=root --spassword=rootpassword

Also try the same thing without specifying a password:

mysqlaccess --db=DB --user=xxx
--superuser=root --spassword=rootpassword

Regards,
Bill K.
Jul 23 '05 #2
Hi Bill, I tried what you told me. I have the results posted here
because I don't understand if it's normal or not. I'm totally confused
about what's happening.
--------------------
[root@hostname mysql]# bin/mysqlaccess --db=DB --user=xxx
--password=yyy --superuser=root --spassword=xxxx;
mysqlaccess Version 2.06, 20 Dec 2000
By RUG-AIV, by Yves Carlier (Yv**********@rug.ac.be)
Changes by Steve Harvey (sg*@vex.net)
This software comes with ABSOLUTELY NO WARRANTY.
Broken pipe
[root@hostname mysql]# bin/mysqlaccess --db=DB --user=xxx
--superuser=root --spassword=xxxx;
mysqlaccess Version 2.06, 20 Dec 2000
By RUG-AIV, by Yves Carlier (Yv**********@rug.ac.be)
Changes by Steve Harvey (sg*@vex.net)
This software comes with ABSOLUTELY NO WARRANTY.
Broken pipe
--------------------------

Zh.Y

Jul 23 '05 #3
21********@gmail.com wrote:
Hi Bill, I tried what you told me. I have the results posted here
because I don't understand if it's normal or not. I'm totally confused
about what's happening.
Okay, I've provided a reference below that explains this error. But
mysqlaccess is just a tool to demonstrate what privileges to that
database are configured, depending on whether you provide a password or
not. It's not strictly necessary to use this tool to solve your
original problem.

Your original posting asked why you have trouble with this command:
"bin/mysqldump --opt --user=xxx --password=xxx DB > DB.bak"
while this command works:
"bin/mysqldump --opt --user=xxx DB > DB.bak"

I assume you mean the second command includes a "-p" option, since you
said you were prompted for a password. If you include no option "-p",
mysql tools assume that the user you specified is connecting without a
password. This is supported by MySQL; a user can be granted privileges
on a database in the case when no password is specified. And no
password will be asked for by mysql tools if you don't give "-p" on the
command line.

Therefore, one possibility I think might explain your original problem
is that user xxx has privilege on database DB, but _only_ when
connecting without specifying a password.

Okay, a different possibility, if you meant that you are actually using
the "-p" option, and therefore are giving a password in response to a
prompt. Your password may contain shell metacharacters, such as !#'"`&;
or even whitespace. This could cause problems in the first command
example, even if the password works when you enter it interactively at a
password prompt.

The solution is that you may need to quote the password, and possibly
put backslashes in even if you quote it. For instance, if your password
is "I'm #1", this might work:

bin/mysqldump --opt --user=xxx --password='I\'m #1' DB > DB.bak

Discovering the correct quoting and escaping combinations to prevent the
shell from interpreting the special characters in a given string can be
complex. Perhaps the simplest solution is to use in your passwords no
characters that are special to the shell (if you need to specify the
password on the command-line, which should be infrequent).

You can also use other methods to specify the password on connect, like
the .my.cnf file, or the MYSQL_PWD environment variable.
See http://dev.mysql.com/doc/mysql/en/pa...-security.html
[root@hostname mysql]# bin/mysqlaccess --db=DB --user=xxx
--password=yyy --superuser=root --spassword=xxxx;
mysqlaccess Version 2.06, 20 Dec 2000
By RUG-AIV, by Yves Carlier (Yv**********@rug.ac.be)
Changes by Steve Harvey (sg*@vex.net)
This software comes with ABSOLUTELY NO WARRANTY.
Broken pipe


I found an explanation of this error in this page from the MySQL
documentation:
http://dev.mysql.com/doc/mysql/en/in...ng-binary.html

If you would like to use mysqlaccess and have the MySQL distribution in
some non-standard place, you must change the location where mysqlaccess
expects to find the mysql client. Edit the bin/mysqlaccess script at
approximately line 18. Search for a line that looks like this:

$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable

Change the path to reflect the location where mysql actually is stored
on your system. If you do not do this, you get a Broken pipe error when
you run mysqlaccess.

Regards,
Bill K.
Jul 23 '05 #4
Hi Bill, you are absolutely a genius! Yes my password contain "!@#$%^".
I used to think this password will take me good luck. However I never
expect it brings me some trouble before the good luck.
Thank you very much! I got it.

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bruce A. Julseth | last post by:
What am I doing wrong? Do I have something set up (config file, et.al) wrong? The following is the senerio: Login as: mysql -u root Run cmd: grant all on * to fred identified by 'julebj';...
0
by: Steve | last post by:
I am using mysql 4.0.14-standard on Redhat linux 9 and am having a problem with backup using mysqldump. The .sql file is written OK, however the program reports an error when attempting to write...
7
by: Adam Smith | last post by:
Hope this is the right news group!! I did a server upgrade and at the same time did a mysql update from 4.0.12 to Ver 12.22 Distrib 4.0.16 mach1# mysql --version mysql Ver 12.22 Distrib...
4
by: Adam Smith | last post by:
I have a dedicated server running 'FreeBSD 4.9 STABLE' at a hosting site. They have done some default installations, presumably from the CVS ports package ??. Herein lies the problem, "I do not...
0
by: Steve | last post by:
Hi, Yesterday I signed up for another dedicated linux server with the hosting company I use and I am having problems getting MySQL 4.1.3 working on it. I've tried just about everything I can...
4
by: Paul M | last post by:
hi there, i've got a website i created, that i've put onto my test server on the web. I have a login page, that when the user comes to it, it first pops up a windows authentication dialog box,...
2
by: arsisthesis | last post by:
Hi all, I have a curious problem with the ERROR 1044 and 1045: -system: OS X 10.4.3 (bash shell) -bash schell prompt: /~ kssun$ -I have set passwd to 'kssun' -I set path:...
2
by: dev2746 | last post by:
Hi :-)..............., I am having a problem with mysqldump with mysql 5.0.27 installed on a win xp pro sp2. I just want to do a simple backup of all my databases. I have xp installed in the D...
2
ram09
by: ram09 | last post by:
im trying to dump my database for a replication but i encounter this error message... mysqldump: Got error: 1045: access denied for user 'ODBC' @ 'localhost' <using password NO> when trying to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.