MYSQL: Installing MySQL 4.1.22 on OS X 10.5

1. to remove MySQL 5.0, see previous post.
2. download the MySQL 4.1.22 installer from MySQL website.
3. install mysql-standard-4.1.22...i686.pkg
4. install mysqlStartupItem.pkg
5. set up MySQL config. In command prompt type:
sudo pico /etc/my.cnf

6. paste the following 4 lines into pico:
[mysqld]
default-character-set=utf8
[client]
default-character-set=utf8

7. exit pico & save file (ctrl+x, Yes for save)
8. now we can start the MySQL server using sudo:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

9. open up command prompt, and enter mysql by typing:
/usr/local/mysql/bin/mysql -u root



EDIT: Getting it to work with OSX's installation of PHP...
Only follow the following instructions if you are having problems with the @mysql_connect method in PHP.

1. create a info.php file that calls the phpinfo(); method
----- NOTE: my version of PHP is 5.2.8
----- scroll down to the mysql section, and look for the value for key: MYSQL_SOCKET
----- MYSQL_SOCKET = /var/mysql/mysql.sock
----- goto /var/mysql and make sure mysql.sock... if the directory is missing or file is missing, you have the same problem I did. Your mysql.sock is probably inside /private/tmp...

2. in command prompt, type the following:
sudo mkdir /var/mysql
sudo chown _mysql /var/mysql

3. (OPTIONAL) in command prompt, type the following:
cp /private/tmp/mysql.sock /var/mysql/mysql.sock

4. edit the my.cnf file again, this time make sure its whole contents are the following 6 lines:
[client]
default-character-set=utf8
socket = /var/mysql/mysql.sock
[mysqld]
default-character-set=utf8
socket = /var/mysql/mysql.sock

5. restart the apache service through System Preferences > Sharing > Web Sharing

6. restart the MySQL service by typing the following 2 lines (one at a time) into command prompt:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

At this point the mysql_connect() php method should work as expected...

No comments: