Databases Reference
In-Depth Information
and the mysql user account that's in the mysql user group:
# useradd --gid mysql mysql
It's all right if you get a message that the group or user already exists.
Now let's configure the MySQL files and directories. Change to the directory where
you installed MySQL; here, we'll assume that MySQL is installed in the directory /usr/
local/mysql :
# cd /usr/local/mysql
To create the data directory and initialize the database for the user mysql , run the
mysql_install_db script from the scripts directory under the MySQL directory:
# scripts/mysql_install_db --user=mysql
You should now change the files in the MySQL directory to be owned by root but be
in the mysql group:
# chown --recursive root:mysql .
And change the database files in the data directory to be be owned by the mysql user
and group:
# chown --recursive mysql:mysql data
We described this use of the chown command in “Restricting access to files and direc-
tories,” earlier in this chapter.
You can now start the server to run under the mysql system account by running the
mysqld_safe program from the MySQL bin directory:
# bin/mysqld_safe --user=mysql &
The ampersand (&) character tells Linux to run the server in the background so that
you can use the shell to do other things. If you don't add the ampersand at the end,
you won't see the shell prompt again until the MySQL server is stopped from another
shell window.
The next thing to do is to set a password for the database root account:
$ bin/mysqladmin --user=root password the_new_mysql_root_password
You can stop the server by running the command:
$ bin/mysqladmin --user=root --password= the_mysql_root_password shutdown
Note that the user root on the Linux system is different from the user root on the
MySQL server, and you don't need to be logged in as the Linux root user to shut down
the server with mysqladmin .
You can also start and stop the server using the mysql.server script that comes in the
support-files directory; start the server with:
$ support-files/mysql.server start
 
Search WWH ::




Custom Search