LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   MySQL: Access denied error (https://www.linuxquestions.org/questions/slackware-14/mysql-access-denied-error-148700/)

Raptor Ramjet 02-21-2004 07:19 AM

MySQL: Access denied error
 
Hello,

I'm trying to install MySQL on Slackware 9.1 and, following quite a bit of time on the web, I've tried installing it using the following steps:

1. Downloaded mysql-<version>.tgz file from Slackware site.

2. Ran installpkg mysql-<version>.tgz

3. cp /etc/my-medium.cnf /etc/my.cnf

4. Edited the /usr/bin/mysql_install_db script and replaced the line containing

hostname=`/bin/hostname`

with

hostname=`/bin/hostname -f `

5. Changed to mysql user

su - mysql

6. Installed MySQL databases

mysql_install_db

7. Launched the MySQL daemon

mysqld_safe &

8. Set a password for root using the following (obviously using "real" values for 'password' and 'myhost' etc.)

mysqladmin -u root password 'password'

9. Attempted to set password for host using:

mysqladmin -u root -h myhost.mydomain password 'password'

Sadly this fails with the following error:

mysqladmin: connect to server at 'myhost.mydomain' failed
error: 'Host 'myhost' is not allowed to connect to this MySQL server

So this is obviously a permissions error but I'm stumped if I can work out what's wrong ? If anyone can point me in the right direction I'd be most grateful as it's entirely frustrating trying to Google up the correct answer...

Thankyou

Raptor Ramjet 02-21-2004 10:20 AM

Hhmmm...

Well after much fiddling around, scratching of head and readng manuals and online help I perfomed a reboot (shutdown -r now) after which it appears that MySQL is working properly (don't know why this shuld make a difference as I've been stopping and starting the mysql daemon between attempts) .

Oh well... I can now log into my test database etc. etc. so now it's onto trying to install phpBB2 (just for the exercise)

So I suppose this will lead to more swearing.........

Raptor Ramjet 02-21-2004 01:51 PM

Following on.......

I'm now trying to install phpBB2 but am having trouble setting up a user to do so. Having given up doing this totally manually I've installed webmin and am now trying to do so via a combination of its interface and the command line. I have been trying to install phpbb2 via it's install page but this consistently fails with a permission error on the database.

The databases and permissions I have set up in mysql are:

Database, User, Hosts, Permissions
phpbb2db, phpbb2user, any, all
test, anonymous, any, (a list of permissions including, Select, Insert etc.)
test\_%, anonymous, any, same (list of permissions including, Select, Insert etc.)

The users and permissions I have set up in mysql are (I have also set up passwords but haven't shown them here):

User, Host, Permissions
Anonymous,localhost,none
Anonymous,myhost,none
phpbb2user,myhost,all
root,localhost,all
root,myhost,all

Now when I open a terminal and use

mysql -u root phpbb2db -p

I am prompted for a password and can then use mysql (which I immediately 'quit' !). However when I use

mysql -u phpbb2user phpbb2db -p

I am prompted for the password, I enter it correctly, but I get an error message saying:

ERROR 1045: Access denied for user 'phpbb2user@localhost' (Using password: YES)

So... I am now utterly confused as to what I'm supposed to do to get this working ? and, having spent all afternoon reading FAQs and manuals etc., would be most grateful for some advice.

Thankyou

Raptor Ramjet 02-22-2004 05:30 AM

Well I'm feeling decidedly schizophrenic today (and slightly unloved) as again I'm replying to my own posts.....

But after powering off my box last night then starting it up again this morning I can now access my mysql database using the users I've set up. The only difference being that, before I shut down the box, I rememberred to set permissions on the rc.mysqld script so mysql would be run at startup i.e.

chmod 755 /etc/rc.d/rc.mysqld

So now I'm just puzzled why this should cause things to start working (or was it the reboot) ? I was manually stopping and restarting the mysql service between attempts yesterday, via webmin & "mysqld_safe &", and it jus't wouldn't work.

Oh well... just shows that incompetence with perseverance sometimes does the trick :)

Yours off re-reading the mysql help & FAQs.

Erol 02-22-2004 06:51 AM

I guess you should have done "mysqladmin reload", so that your permissions changes in the database itself are applied.

Raptor Ramjet 02-22-2004 08:07 AM

Cheers Erol.

I hadn't spotted that in the manual yet - the mysql manual is after all quite comprehensive (i.e. large)

But now I know how to do it in the future. I'll write it up in my log.

Thanks for the advice


All times are GMT -5. The time now is 04:27 PM.