0

I am confused. When I connect to mysql using 127.0.0.1. I get a mysql server with only test database. If I connect to database using localhost, I see my databases. Why is this.

Note, at one point I did have macports installed with mysql. But I uninstalled it and I thought I removed everything. What can I do the eliminate this issue for good ? now i use apache native installation and installed the new mysql manually

When I look at my processes on my mac, I see the following

root               82   0.0  0.0  2468784    424   ??  Ss   22Jan14   0:00.30 /opt/local/bin/daemondo --label=apache2 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/a
root               81   0.0  0.0  2468784    392   ??  Ss   22Jan14   0:00.30 /opt/local/bin/daemondo --label=mysql5 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mys

Could these be the macports mysql and apache that is autostarting ?? and how would I remove them from auto starting ?

[EDIT]

When I do use mysql; SELECT user from user; I get the following

+------+
| user |
+------+
| root |
| root |
|      |
| root |
|      |
| root |
+------+

Also keep this in mind. I use mysqlworkbench. and yes I had no password setup but when i changed the host from localhost to 127.0.0.1 I couldnt see databases; But I killed those processes above and now I get my tables both ways and I never changed any permissions

numerical25
  • 10,524
  • 36
  • 130
  • 209

3 Answers3

1

This is likely because you have your permissions set explicitly to 'root'@'localhost'.

You may need to add 'root'@'127.0.0.1'

This post should help with how to use GRANT syntax.

How to grant remote access permissions to mysql server for user?

======= From comments ========

Sounds like you might have two database instances running.

Have you tried looking through the MacPort StartupItems: Startup Reference

Try opening up a terminal and type: launchctl

See if it's in the list and unload it.

For example (I can't see the whole line in your OP so please check/modify before running):
-> Each line should end with a .plist file.

sudo launchctl unload -w /opt/local/etc/LaunchDaemons/org.macports.apache2/a....plist
sudo launchctl unload -w /opt/local/etc/LaunchDaemons/org.macports.mysql5/mys....plist
Community
  • 1
  • 1
Timeout
  • 7,759
  • 26
  • 38
  • I killed those 2 processes. and now if I use localhost or 127.0.0.1 they both show the right databases; So I guess I fixed the issue. The question is how do I stop those processes I added above from auto starting on loadup – numerical25 Jan 31 '14 at 01:07
  • @numerical25 Adding some extra info to the post that may help. – Timeout Jan 31 '14 at 01:17
0

It's down to how the users are configured in mysql. You probably have two users, 'user'@'127.0.0.1' and 'user'@'localhost' with differing permissions to the databases.

arco444
  • 22,002
  • 12
  • 63
  • 67
  • I was able to kill those processes I mention above and now my issue is gone. If your assumption is correct, I should still have the issue right ? – numerical25 Jan 31 '14 at 01:09
0

login as root to the mysql database Code:

mysql -u root -p mysql

and run Code:

SELECT password,host FROM user where user='root';

Make sure password is set to 127.0.0.1 else you will be able to login without a password: Code:

SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('Add-Your_password-here');

Source : http://wary.cc/NpdvD

madhushankarox
  • 1,448
  • 1
  • 13
  • 17