Page 1 of 1

How to fix root password problem ?

Posted: Sun May 29, 2011 4:11 pm
by newphper
Hello,
I just reinstalled snow leopard and am having some problems logging into mysql now.
Does anyone know the answer to this problem ?
Below is what happens when I try to login through terminal

Last login: Mon May 30 06:09:35 on ttys000
reg:~ regellis$ /Library/StartupItems/MySQLCOM/MySQLCOM start;
Starting MySQL database server
reg:~ regellis$ mysql;
-bash: mysql: command not found
reg:~ regellis$ /usr/local/mysql/bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
reg:~ regellis$


Below is what happens when I try to view the directory/folder
When I try to "go to" "/usr/local/mysql/bin/mysql" a message pops up
The folder “mysql” can’t be opened because you don’t have permission to see its contents.
I always log into my mac as administrator…………

Re: How to fix root password problem ?

Posted: Mon May 30, 2011 4:11 am
by VladSun
Run MySQL daemon with --skip-grant-tables option, change root password and restart the server.

Re: How to fix root password problem ?

Posted: Mon May 30, 2011 8:25 am
by Weirdan
It doesn't seem to be a problem with password though - mysql cannot connect via socket, which most likely means the socket is not there (server not running or using different path).

Run

Code: Select all

ps aux | grep mysqld
look for the daemon process and note the path to it.

Then run

Code: Select all

$PATH_YOU_NOTED/mysql_config
and note the path in '--socket' section

run

Code: Select all

/usr/local/mysql/bin/mysql -S $SOCKET_PATH $ANY_OTHER_ARGUMENTS
Now it should connect successfully. If it complains about wrong password, follow the VladSun's advice.

Re: How to fix root password problem ?

Posted: Fri Jun 03, 2011 1:53 pm
by newphper
Thank you for your help and advice, I actually used time machine to fix the problem.

For the time being it was the easiest way until I learn more about the MySql commands.

I also found a tool called Tinker Tool, this seems a handy program for macs, have only had my first mac for 2 months now.