Click to See Complete Forum and Search --> : Connecting to mysql


webee
01-28-2003, 01:22 PM
Hi: I have installed mysql3.23.55 on linux RH7.1. Now mysql is running successfully on my system. When I try connecting thru
java(mysql-connector-java-3.0.1) I am getting an Access Denied error. It says mysql@machinename access denied.
Now i tried from command line: mysql -u mysql -p -h localhost. This works, but when i give:mysql -u mysql -p -h machinename it doesnt work.
Why is that? The user mysql has all priviliges granted. Thanks for any help on this.

iDxMan
01-28-2003, 01:35 PM
Did you flush the privileges after granting mysql the access from that host?

mysqladmin -uroot -p flush-privileges

webee
01-28-2003, 01:39 PM
Yes I did right now. But I am getting the same error.
And one more thing, my client and server are in the same machines. So if localhost works, the machine name should also work right?

webee
01-28-2003, 01:52 PM
Hi:
I tried executing the SET password like this:

SET PASSWORD FOR mysql@machinename=PASSWORD('linux');

The first time I had given:

SET PASSWORD FOR mysql=PASSWORD('linux');

Does it mean that for every client I connect from, I should execute the SET PASSWORD statement??
thanks a lot.

MattCauth
02-01-2003, 10:12 PM
Log into mysql from the command line as root. Then use the 'grant' command from the command line:

grant all on *.* to root@machinename identified by '[your password here]' ;


-- and it'll work. Go to mysql.com and look at the docs for the 'grant' commnd: http://www.mysql.com/doc/en/GRANT.html for more details.

Matt

webee
02-02-2003, 07:08 PM
Thank you. It works. I have one more question. How can I change the location of my data directory? By default it is in /var/lib folder.
Thank you once again.

MattCauth
02-02-2003, 08:51 PM
Not 100% sure to be honest. You can specify --datadir on startup, or mysql.com says:

" You can also add options for mysql.server in a global `/etc/my.cnf' file. A typical `/etc/my.cnf' file might look like this:

[mysqld]
datadir=/usr/local/mysql/var
socket=/var/tmp/mysql.sock
port=3306
user=mysql "

-- Good luck. There is also a datadir compile-time option, which means something different than the one above I believe.

Matt