Databases Reference
In-Depth Information
are typically used by other common programs. For instance, port 8080 is often used by
web servers and proxies. A web search for “common ports” is a good way to learn about
these. Note that only the root user can allocate port numbers below 1024. We'll use
the port number 57777 for our example.
You also need to specify a custom location for the socket file; this is a special type of
file used by clients to connect to a server on the same machine. A common choice for
a socket file location is the server data directory; we'll use the file path ~/mysql/data/
mysql.sock in the following example.
Now, start the server using the nonstandard port and socket file:
$ bin/mysqld_safe --port=57777 --socket=~/mysql/data/mysql.sock &
Note that if you're using a nonstandard MySQL installation directory and don't start
the server from inside that directory, you have to specify the path to the mysqld_safe
program and tell this program where the data directory is. For example, to run the
program from the ~/mysql/bin directory with the data directory ~/mysql/data , you
would type (all on one line):
$ ~/mysql/bin/mysqld_safe \
--port=57777 \
--socket=~/mysql/data/mysql.sock \
--datadir=~/mysql/data &
Now that the server is running, set a password for the database root account by typing:
$ bin/mysqladmin \
--port=57777 \
--socket=~/mysql/data/mysql.sock \
--user=root \
password the_new_mysql_root_password
Once you've added a password for the database root user, you'll have to use it for all
further client connections to the server for the root account.
You can stop the server using the mysqladmin shutdown command, with the necessary
options added to identify the server. Type all on one line:
$ bin/mysqladmin \
--port=57777 \
--socket=~/mysql/data/mysql.sock \
--user=root \
--password= the_mysql_root_password \
shutdown
Configuring MySQL for automatic start
If you're planning to use MySQL a lot, you'll probably want to have the server start
automatically every time your computer is switched on. The typical way to do this is
to call a script to start and stop the MySQL server when the computer is started and
stopped.
 
Search WWH ::




Custom Search