Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 03:34 am EST

Geeklog Forums

Grrr, why won't this work?


JoeJoe

Anonymous
stressed
Does anyone have any insight into this problem that I am having? Before you stop reading, I have tried doing this in the MySQL database:

% mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.23.51-entropy.ch
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> create database MyBlog;
Query OK, 1 row affected (0.08 sec)

mysql> use MyBlog;
Database changed

mysql> GRANT ALL PRIVILEGES ON MyBlog.* TO mysqlUser@"%" IDENTIFIED BY
"password" WITH GRANT OPTION;
Query OK, 0 rows affected (0.15 sec)

mysql> QUIT

When I try to access my geeklog I get:
Warning: MySQL Connection Failed: Access denied for user: 'mysqlUser@my.ip.address' (Using password: YES) in /home/someuser/geeklog-1.3.9sr2/system/databases/mysql.class.php on line 111

The reason that is is on line 111 is becausse I added 3 print statements to the mysql.class.php file right before the error line to help debug. They print out:
Location: 1.2.3.4
User: mysqlUser
Password: password

When I try accessing the database with the geeklog pages I get access denied, even though it is using the right IP, user, and password. What's really interesting though is when I try to connect to the MySQL database. If I do:
% mysql -umysqlUser -ppassword MyBlog
then I am able to succesfully log in and do a [backslash] s to verify that I am in the right database and that I am connected, etc.

mysql> [backslash] s
--------------
mysql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)

Connection id: 63
Current database: MyBlog
Current user: mysqlUser@localhost
Current pager: stdout
Using outfile: ''
Server version: 3.23.58
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 4 days 16 hours 58 min 50 sec

Threads: 1 Questions: 86 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 1 Queries per second avg: 0.000
--------------

mysql>


Any ideas as to what might be causing this problem? I am at a loss.

 Quote

Status: offline

tomw

Forum User
Full Member
Registered: 08/12/02
Posts: 300
The user needs to be user@localhost not user@%
 Quote

Status: offline

JoeJoe

Forum User
Newbie
Registered: 11/24/04
Posts: 5
Why does it work using the mysql command line tool but not with the PHP pages? Also, why would I want to make it localhost?? When I get the error it says that it's user mysqlUser@my.ip.address not localhost (thought I did notice that when I use the command line it logs me in as mysqlUser@localhost).
 Quote

Status: offline

JoeJoe

Forum User
Newbie
Registered: 11/24/04
Posts: 5
Banging your head I'm still confused as to why this is not working. When I set this up I used the % which is the wildcard (kind of like *). So when I log on locally with mysql, it sees that I am coming from localhost, matches it with the % (since I never put in the localhost) and lets me in. But when I try to access the database via the geeklog pages it says that I am coming from my.ip.address and won't let me in, even though I am using the right user name and password (so says the debug print out statements). Since the wildcard worked with mysql, why doesn't it work with the geeklog PHP?

Another interesting question - Assume that I am accessing the webpage from computer at IP A, the server is at IP B. When I connect to the webpage (and get these errors), why does it say that access is denied to user mysqlUser@B, instead of mysqlUser@localhost? Since I am accessing the apache web server on B, which parses the PHP and then exucutes the MySQL request, wouldn't the request to the MySQL server be coming from localhost instead of B?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Are we talking about a database that is located at a hosting service? Those usually are pretty restrictive (for security reasons) and only allow database connections from localhost or certain other hosts.

bye, Dirk
 Quote

Status: offline

JoeJoe

Forum User
Newbie
Registered: 11/24/04
Posts: 5
The database is located remotely, but I know a guy who has root access, so pretty much anythin g I want set up I can get. It's just a matter of getting all of the right settings. I tried both the:
mysql> GRANT ALL PRIVILEGES ON MyBlog.* TO mysqlUser@"%" IDENTIFIED BY "password" WITH GRANT OPTION
and
mysql> GRANT ALL PRIVILEGES ON MyBlog.* TO mysqlUser@"localhost" IDENTIFIED BY "password" WITH GRANT OPTION

and I still get:
Host - 1.2.3.4
User - mysqlUser
Pass - password

Warning: Access denied for user: 'mysqlUser@my.ip.address' (Using password: YES) in /home/mysqlUser/geeklog-1.3.9sr2/system/databases/mysql.class.php on line 111

Warning: MySQL Connection Failed: Access denied for user: 'mysqlUser@my.ip.address' (Using password: YES) in /home/mysqlUser/geeklog-1.3.9sr2/system/databases/mysql.class.php on line 111
Cannnot connect to DB server

Any ideas on this? Like I said, I pretty much have root access, so if there's anything that I need to check/change I can get it done. There wouldn't be any firewall problems, would there? I would think that the PHP requests would be on the local side and thus probably going through unix sockets (which the mysql command line tool uses) which he doesn't have firewalled.
 Quote

Status: offline

thinredline

Forum User
Newbie
Registered: 11/26/04
Posts: 1
you might need to use the set password command

set password for 'user'@'host' = old_password ('password');
flush prvileges;

then q


 Quote

Status: offline

JoeJoe

Forum User
Newbie
Registered: 11/24/04
Posts: 5
Nope, didn't work. I changed the passwords and it still didn't work. I can log in with (and only with) the new passwords using mysql, but the geeklog pages still don't work (and yes, I changed the password in the config.php, and it's verified by my debug statements). Any other ideas?
 Quote

Status: offline

JoeJoe

Forum User
Newbie
Registered: 11/24/04
Posts: 5
Well, I finally got it working. I don't understand why it's working , but it is so I guess I shouldn't care. What I ended up having to do is in config.php set the $_DB_host to 'localhost'. If I tried the my.domain.com version or the A.B.C.D version, it wouldn't work, but for some reason 'localhost' does. Weird.
 Quote

All times are EST. The time is now 03:34 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content