Databases Reference
In-Depth Information
to start the MySQL server, and:
$
sudo /usr/local/mysql/support-files/mysql.server stop
to stop it.
Third, if you installed the
MySQLStartupItem.pkg
file during the installation process,
you can start the server from the command line by calling:
$
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
and stop it by calling:
$
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
Finally, you can use the generic
mysqld_safe
and
mysqladmin
programs from the com-
mand prompt. To start the server to run under the system
mysql
user account, type:
$
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql
Then, press the Ctrl-Z key combination, and type
bg
to leave the server running in the
background.
You can then stop the server by running the command:
$
/usr/local/mysql/bin/mysqladmin --user=root \
--password=
the_mysql_root_password shutdown
This approach is the most robust, and also the most flexible if you need to add custom
options to your server.
The first thing you should do once you've started the server is to set a password for the
database
root
account:
$
sudo /usr/local/mysql/bin/mysqladmin --user=root password \
the_new_mysql_root_password
Once you've set the MySQL root password, you'll need to use this in all further accesses
to the server. For example, to shut down the server using
mysqladmin
, you would type:
$
/usr/local/mysql/bin/mysqladmin --user=root \
--password=
the_mysql_root_password shutdown
Installing Only MySQL Using the no-installer Package from MySQL AB
Following the instructions in “Downloading MySQL from the MySQL AB Web Site,”
earlier in this chapter, visit the MySQL AB downloads page and download the “Without
installer” package corresponding to the version of your operating system and processor
type.
This will download a compressed package with a name like
mysql-standard-5.0.22-
osx10.4-i686.tar.gz
. This is normally automatically decompressed and unpacked by
the web browser to leave the directory
mysql-standard-5.0.22-osx10.4-i686
in the
download directory. You may instead find that your browser decompresses the file but
does not unpack it. If this is the case, you'll find the file
mysql-standard-5.0.22-osx10.4-