Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

micsaund

macrumors 6502
Original poster
May 31, 2004
364
0
Colorado, USA
Hi,

I recently decided to try getting PHP, Apache, and MySQL going on my new PB. I got Apache and PHP going without any problems, but MySQL is giving me a hassle and I was hoping someone here might have some ideas.

I downloaded the Mac binary package from www.mysql.com ("Installer package (Mac OS X v10.3) Standard 4.0.20") and installed it by running the installer.

However, it appears that the installer did not create the user-account tables (or whatever happens when MySQL creates users):
===============================================
Code:
[osiris]/Users/mikesa> mysql -u root
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
===============================================


I tried setting the password just for fun:
===============================================
Code:
[osiris]/usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc> ./bin/mysqladmin -u root password 'pass123'
./bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'
===============================================


So, it looks like either 1) I cannot figure-out how to get the daemon running or 2) my suspicion that the user tables are missing is true.

It appears I have the daemon running, as I can do this:
===============================================
Code:
[osiris]/Users/mikesa> ps -aux|grep mysql
mysql   1085   0.2  1.1    51252  11944  ??  S     1:41AM   0:01.97 /usr/local/mysql/bin/mysqld --defaults-e
root     339   0.0  0.1    18644    628  ??  S    Sun09AM   0:00.04 sh ./bin/mysqld_safe --datadir=/usr/loca
mikesa  1196   0.0  0.0     8860      8 std  R+    7:39PM   0:00.00 grep mysql
===============================================


I then tried installing the default grant tables using the official script (I tried without sudo and it gave me several "permission denied" errors and bombed):
===============================================
Code:
[osiris]/usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc> sudo ./scripts/mysql_install_db
Password:
Installing all prepared tables
040823 19:42:29  Warning: Setting lower_case_table_names=2 because file system for /usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc/./data/ is case insensitive
040823 19:42:29  ./bin/mysqld: Shutdown Complete
<snip stuff about remembering to change password/etc.>
===============================================

I then restart mysqld with:
===============================================
Code:
[osiris]/usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc> sudo bin/mysqld_safe &
[1] 1232
[osiris]/usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc> A mysqld process already exists

[1]    Exit 1                        sudo bin/mysqld_safe
[osiris]/usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc> ps -aux | grep mysql
root     339   0.0  0.1    18644    628  ??  S    Sun09AM   0:00.04 sh ./bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local
mysql   1085   0.0  1.1    51252  11944  ??  S     1:41AM   0:02.51 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my
mikesa  1256   0.0  0.0     8860      8 std  R+    7:44PM   0:00.00 grep mysql
===============================================


I don't know why I get the "process is already running" thing since I did a ps and didn't have anything running after the grant-table script killed it. But, it is running now and when I try to set the password, I'm back to:
===============================================
Code:
[osiris]/usr/local/mysql-standard-4.0.20-apple-darwin7.3.0-powerpc> mysqladmin -u root password 'pass123'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'
===============================================


I'm guessing that I'm messing something up with the sudo or perhaps the installer is broken (not likely). I'm not used to having to sudo-run stuff (on my FreeBSD boxes, I just login as root when I need to). Any ideas what I'm missing here?

Thanks,
Mike
 
First, I would install the startup script that comes with the package. Then you can easily restart MySQL with:

sudo /Library/StartupItems/MySQL/MySQL stop
sudo /Library/StartupItems/MySQL/MySQL start

Note that some of the later revisions install it as:

sudo /Library/StartupItems/MySQLCOM/MySQL stop
sudo /Library/StartupItems/MySQLCOM/MySQL start

This prevents them from interfering with OS X Server's MySQL installation.

After restarting the server, you should be able to see the MySQL port open, which is 3306:

netstat -an

If it is you should be able to use mysqladmin. Keep in mind that when you are just wanting to log in as root into MySQL, you need to use:

mysql -u root -p

so it will prompt you for authentication.
 
hahaha... I knew it was something retarded I was doing! ;)

Thanks, Tom -- It was the fact that I was just doing "mysql -u root" rather than "mysql -u root -p". I was mistakenly assuming that if I didn't specify a password, I'd be prompted for one.

Anyway, it seems to be working now. Also, thanks for the start/stop info. I figured there had to be a more "Mac" way to do it than the mysqld_safe that I was using.

Mike
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.