Howto: MySQL on Mac OS

Here's a howto about installing MySQL on Mac OS tiger.
First you need the MySQL installation package for Mac OS.
You can download it here.

The package contains a readme file, the MySQL application itself, and a MySQLStartupitem, for automaticly starting MySQL server at boot up. The package also contains a prefPane file, which controls the MySQL server.

First install the MySQL application, and the prefPane file, and if necessary the Startupitem.

After this, we're going to add 2 aliases, mysql and mysqladmin:
    #> alias mysql=/usr/local/mysql/bin/mysql
    #> alias mysqladmin=/usr/local/mysql/bin/mysqladmin

It's highly recommended to change the password, which is blank per default.

Enter the following commands:
    #> mysql -u root mysql
    #> SET PASSWORD FOR root@localhost=PASSWORD('mypassword');
    #> mysql -u root mysql
    ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
In this example, we set the root password to mypassword. Note from the above that the password wasn't set. If we try this again, we need to use the -p option to enter the password:
    #> mysql -u root -p mysql

To reset a root password that you forgot (using paths on our system):
    mysqld --skip-grant-tables --user=root
Go back into MySQL with the client:
    [root@host root]# mysql
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 1 to server version: 3.23.41
    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

    mysql> USE mysql

    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed

    mysql> UPDATE user
    #> SET password=password("newpassword")
    #> WHERE user="root";

    Query OK, 2 rows affected (0.04 sec)
    Rows matched: 2 Changed: 2 Warnings: 0
    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)

    mysql> exit;
    [root@host root]#killall mysqld
Comments (0)  Permalink

Comments

add a comment

This blog is gravatar enabled.
Your email adress will never be published.
Comment spam will be deleted!

Name*
E-Mail
For Spammers Only
URL
Comment*
Notify me via E-Mail when new comments are made to this entry
Remember me (needs cookies)