216

To set the root password:

$ sudo /usr/bin/mysqladmin shutdown

$ sudo /usr/bin/mysqld_safe --skip-grant-tables --skip-networking &

$ sudo /usr/bin/mysqladmin -u root flush-privileges password new-password

When you set up MySQL service for the first time, make sure to set up a password for the MySQL root user to protect your server from unauthorized access.

To create a database:

$ mysqladmin -u root password "password"

> create database mydatabase

To set the network option:

Edit /etc/mysqlManager.plist and set the string value of the allowNetwork key to either

"yes" or "no".

To start mysqld:

1Edit /etc/hostconfig and set MySQL to -YES-.

2Start mysqld.

$ SystemStarter start MySQL

To stop mysqld (and clear flag in /etc/hostconfig so it does not start upon reboot):

1Edit /etc/hostconfig and set MySQL to -NO-.

2Stop mysqld.

$ sudo SystemStarter stop MySQL

The MySQL startup item launches the mysqld daemon with arguments extracted from the configuration file /etc/mysqlManager.plist. It uses the Apple-provided

mysqld_manager_options tool to do this.

The following are useful tools distributed with MySQL. Each has its own man page:

Âmysql_install_db—Installs the default MySQL database

Âmysqladmin—Administers the MySQL database

Âmysqld_safe—The mysqld parent (watchdog) process

Âmysql—The MySQL database text-based client

For more information about setting up and configuring MySQL, see www.mysql.org.

Chapter 13 Working with Web Technologies

Page 216
Image 216
Apple Mac OS X Server manual To set the root password, To create a database, To set the network option, To start mysqld