Installation

ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

by Ever Barbero -
Number of replies: 5
I am a newby, administering my own server at the university, no IT help from anyone here.
I installed WW2.12 Ubuntu 16.04.
I am comfortable with course admin, creating problems, etc.
Now I want to backup everything in case my 10yr old server goes down.

I am following the Backup and Disaster Recovery Wiki

I wrote a .my.cnf file in my $home directory: wwadmin@machineName:/$
exactly as in the Wiky

[client]
user=webworkWrite
password=[password]

I am 100% sure 'password' is correct because I chages it myself following another Wiki and it is there in .conf file where it should be. I am also sure the .my.cnf is written because I can see it with more .my.cnf

When I try the next step, to test if it is working,

mysql webwork

I get the error

ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost' (using password: YES)

What should I do to fix this?

In reply to Ever Barbero

Re: ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

by Danny Glin -
It looks like it is reading the .my.cnf file because it is is getting the username from that file. My first thought is that there is a special character in your password which is causing problems (a quick google search shows people having trouble with #, but I wouldn't be surprised if $, % or maybe others caused issues as well).

First thing I would try is to connect while manually typing the password. Use the command:
mysql -u webworkWrite -p webwork

This should prompt you for your password. If this works, then it is likely what I described above. In this case I have three suggestions to try:
  1. Put the password in quotes in your .my.cnf file (i.e. password="[password]")
  2. Escape any special characters in the password by putting a backslash in front of them (i.e. if your password is "sec#ret", then put password=sec\#ret in .my.cnf).
  3. Change the password to something that doesn't use the problematic special characters. Most symbols should be fine. Unfortunately I can't tell you exactly which ones cause problems.
In reply to Danny Glin

Re: ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

by Ever Barbero -
Only letters and numbers in the password.
Suggested command line worked. I am in.
Anything else I can try? 
In reply to Ever Barbero

Re: ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

by Danny Glin -
Which version of mysql are you using?

Did you try putting the password in quotes? Are there any spaces around the equal sign (there shouldn't be)?

Based on an answer I found online you could try adding two more sections to your my.cnf:
[mysql] user=root password="[password]" [mysqldump] user=root password="[password]" 

In reply to Danny Glin

Re: ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

by Ever Barbero -
I am using mysql 14.14 that installed with the 2.12 live DVD
Below is what I have now in my.cnf (or should I use .my.cnf) Neither works. 

Both db_password and root_password are letters and numbers only. I still get the error.

I renamed $mv my.cnf mi.cnf so that mysql cannot find the file but still the error shows user 'wwadmin'@'localhost'
... is that the problem? I am not 'localhost', am I? I have WebWork on a server called 'blackford' that I access via ssh.  

I try to access the db at the prompt like this
$mysql -u webworkWrite -p
and typed the 'database_password' -> it works, I am in! 

Why it does not work when I type
$ mysql webwork (as the Wiki says)

or $ mysql webworkWrite

What should I do? 

[client]
user="[webworkWrite]"
password="[db_password]"
[mysql] 
user=root password="[root_password]" 
[mysqldump] 
user=root password="[root_password]" 
In reply to Danny Glin

Re: ERROR 1045 (28000): Access denied for user 'webworkWrite'@'localhost'

by Ever Barbero -
this works from the prompt !!!

$mysqldump -u webworkWrite --opt webwork -p
followed by typing the database-password manually

GOT IT; the [] were the killer.