and stop the server with support-files/mysql.server stopYou can copy the
mysql.server script and place it as the file
mysql in the
/etc/init.ddirectory:
#
cp support-files/mysql.server /etc/init.d/mysqlThis allows you to
control the server by typing /etc/init.d/mysql startand
#
/etc/init.d/mysql stopas with the package-based installation approaches. Importantly, this also allows you to configure the server to start on every boot this is explained later in “Configuring
MySQL for automatic start.”
Configuring a local serverWith
a local installation, the MySQL files will be placed in a directory under your home directory, and the server will run under your username rather than mysql
First, change to the directory containing the MySQL installation. If you followed our instructions in Installing MySQL on Linux by
Compiling the Source Code fromMySQL AB you can type
cd
/mysqlTo configure the data directory and initialize the database,
you must run the mysql_install_db script from the
scripts directory
scripts/mysql_install_dbIf you want to use a data directory that’s not under the
MySQL installation directory,
you can specify the path using the datadir option, as in
mysql_install_db datadir=/home/adam/MySQL_DataHowever, we’ll assume you’ll use the default data directory
/mysql/data.
Now you need to change the files in the MySQL directory to be owned by your username and your group. For
the username and group adam, you would write chown -recursive
adam:adam
/mysqlAgain, we described this use of the chown command earlier in Restricting access to files and directories.”
By default, MySQL listens for incoming client connections on port number 3306; if there’s already another server running on the same computer, you should choose a different port number for this installation. It’s best to
avoid using port numbers thatShare with your friends: