Now consider the case where MySQL has been installed to the directory
/home/adam/mysql-5.0.22.
You can imagine the directory /Users/adam/mysql-5.0.22 being used for
Mac OS X.
For nonstandard installations, the mysqld_safe program should be called from the MySQL installation directory, so we first
change to that directory cd /home/adam/mysql-5.0.22and then start the server by typing (all on one line
bin/mysqld_safe \ -port \ --socket=/home/adam/mysql-5.0.22/logs/mysqld-new.sock.file \ --basedir=/home/adam/mysql-5.0.22 \ --datadir=/home/adam/mysql-5.0.22/data \ --log=/home/adam/mysql-5.0.22/logs/main.log \ --log-error=/home/adam/mysql-5.0.22/logs/error.log \ --pid-file=/home/adam/mysql-5.0.22/logs/zahra.pidThe corresponding options file entries would be:
[mysqld]
port= socket /home/adam/mysql-5.0.22/logs/mysqld-new.sock.file basedir= /home/adam/mysql-5.0.22
datadir= /home/adam/mysql-5.0.22/data log /home/adam/mysql-5.0.22/logs/main.log log-error=/home/adam/mysql-5.0.22/logs/error.log pid-file= /home/adam/mysql-5.0.22/logs/zahra.pid
Finally, let’s
look at an example for Windows, where we have MySQL installed in the directory
C:\mysql-5.0.22-win32. We want to have
the MySQL datafiles placed inC:\mysql\data, we want the logfiles placed in
C:\mysql\logs, and we want the server to listen on port 13306. So we type (all on one line):
C:\>
mysqld-net.exe \ -port \ --basedir=C:\mysql-5.0.22-win32 \ --datadir=C:\mysql\data \ --log-bin=C:\mysql\logs\mysql-binary.logNote that the specified
directories must exist, and the data directory must contain the mysql database files (the privilege tables otherwise, MySQL will complain and abort.
Share with your friends: