Specifications

5 Select the Allow network connections” checkbox to permit users to access
MySQL service.
This grants users access to database information through the web server.
6 Enter the path to the location of your database in the Database location eld.
You can also click the Choose button and browse for the folder you want to use.
7 Click Save.
From the command line:
To set/change the root password: m
$ sudo /usr/sbin/serveradmin stop mysql
$ sudo /usr/sbin/serveradmin settings mysql:rootPassword = password
$ sudo /usr/sbin/serveradmin start mysql
To change the database location: m
$ sudo /usr/sbin/serveradmin stop mysql
$ sudo /usr/sbin/serveradmin settings mysql:databaseLocation = /path/to/
new/ database/
$ sudo /usr/sbin/serveradmin start mysql
The MySQL root password is not related to the Mac OS X Server root password.
MySQL is precongured to use /var/mysql/ as the default database location. By default,
changing the database location creates a database at the chosen path if one does not
exist at that location.
To move a database to a new location: m
$ sudo /usr/sbin/serveradmin stop mysql
$ sudo cp -Rp /oldpath/mysql /newpath/
$ sudo /usr/sbin/serveradmin settings mysql:databaseLocation = /newpath/
mysql
$ sudo /usr/sbin/serveradmin start mysql
To set the network option: m
$ sudo /usr/sbin/serveradmin stop mysql
$ sudo /usr/sbin/serveradmin settings mysql:allowNetwork = yes
Or
$ sudo /usr/sbin/serveradmin settings mysql:allowNetwork = no
$ sudo /usr/sbin/serveradmin start mysql
To setup remote access to MySQL and to grant access to all databases: m
mysql -u database_user -p database_name
mysql> GRANT ALL PRIVILEGES ON *.* TO Username@hostname_or_IP_Address
IDENTIFIED BY 'password' WITH GRANT OPTION;
68 Chapter 5 Working with Open Source Applications