Here is a brief article on the command line options used to start the mysql server. I am user version 4.1.18 for this article. Some options include specifying a defaults file my.cnf specifying a port, and specifying a new lockfile location. The idea is to be able to run a mysql server as non root if you do not have root access to run the mysql file.
Here is a quick list of options I use to run mysql server as non root.
The system I ran on had a /etc/my.cnf file that I could not touch. Mysql by default tries to find important files in these typical locations. However, I needed my own defaults file. To accomplish this, I used the –defaults-file=/some/dir/my.cnf option as the very first options.
The php client for mysql was a 3.X version and my server was a 4.1.X version. To solve this I had to use the old passwords option on the command line. However, you must place the –defaults-file as the very first option. You must also start mysql using the mysqld and not mysql_safe binary. For some reason the mysql_safe was not honoring the –old-passwords options. Remember to update the passwords stored in the mysql.user table with the OLD_PASSWORD(’zzzzz’) command. So far our options to start are
mysqld –defaults-file=/some/dir/my.cnf –old-passwords
Next I wanted to start the mysql server on a non standard port, so I used the –port option
I also wanted to place the socket file in a non-standard location because there was a mysql server already running on the network. I used the
–socket=/some/file/mysql.sock option
finally, I wanted to specify where to store the physical location of my database tables. I used the option
–datadir=/some/dir/
To sum it up here was my final command to start the mysql server
mysqld –defaults-file=/some/file/my.cnf –old-passwords –port=1234 –socket=/some/dir/mysql.sock –datadir=/some/data/dir/mysql &