473,881 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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'@'localhos t' (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.


Jul 23 '05 #1
4 15633
21********@gmai l.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=rootp assword

Also try the same thing without specifying a password:

mysqlaccess --db=DB --user=xxx
--superuser=root --spassword=rootp assword

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**********@r ug.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**********@r ug.ac.be)
Changes by Steve Harvey (sg*@vex.net)
This software comes with ABSOLUTELY NO WARRANTY.
Broken pipe


Jul 23 '05 #3
21********@gmai l.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**********@r ug.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

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.

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

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'; Return: Query ok, 0 rows affected (0.90 sec)
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 the .txt file, i.e. mysqldump: Got error: 1: Can't create/write to file '/......txt' (Errcode: 13) when executing 'Select into outfile'. This seems very odd, as I am running the program locally as mysql root and the directory has write...
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.0.16, for portbld-freebsd4.9 (i386) I attempted to restore the DB with
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 know" what they have done! At first it was apparent that MySQL was installed mysql_install_db ; GRANT TABLES etc. ??? so I ran "mysql_install_db --force"
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 think of to login via the MySQL client but get a variation of the following error every time: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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, and i dont know why? i click cancel on it and the page still works as normal. How can i remove this, and why is it appearing? i am also not using any .NET authentication methods or anything..
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: PATH=${PATH}:/usr/local/mysql/bin - symptom 1
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 drive and the mysql datafiles in a folder "MySQL Datafiles" in the F drive. This is my problem: I go to this location "D:\Program Files\MySQL\MySQL Server 5.0\bin" from the command prompt and type:
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 connect.... can somebody tell me how can i solve this problem please..
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.