472,973 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 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 15524
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.