2002-08-16 09:24:08 +08:00
<sect2 >
2003-09-29 06:10:55 +08:00
<title > Configuring <application > My<acronym > SQL</acronym> </application> </title>
2002-08-16 09:24:08 +08:00
<sect3 >
<title > Config files</title>
2003-04-21 06:15:01 +08:00
<para > <filename > /etc/my.cnf</filename> , <filename > ~/.my.cnf</filename> </para>
2002-08-16 09:24:08 +08:00
</sect3>
<sect3 >
<title > Configuration Information</title>
<para > There are several default configurations file available in
2003-09-07 22:14:01 +08:00
<filename class= "directory" > /usr/share/mysql</filename> which you can use.</para>
2002-08-16 09:24:08 +08:00
2004-01-13 01:55:49 +08:00
<screen > <userinput > <command > cp /usr/share/mysql/my-medium.cnf /etc/my.cnf</command> </userinput> </screen>
2002-08-16 09:24:08 +08:00
<para > We can now install a database and change the ownership to the
2003-10-04 00:43:11 +08:00
unprivileged user and group.</para>
2002-08-16 09:24:08 +08:00
2004-01-13 01:55:49 +08:00
<screen > <userinput > <command > mysql_install_db & &
2003-09-07 22:14:01 +08:00
chown -R mysql:mysql /var/lib/mysql</command> </userinput> </screen>
2002-08-16 09:24:08 +08:00
<para > Further configuration requires that the mysql server be running:</para>
2004-01-13 01:55:49 +08:00
<screen > <userinput > <command > mysqld_safe --user=mysql 2> & 1 > /dev/null & </command> </userinput> </screen>
2002-08-16 09:24:08 +08:00
2003-12-14 01:21:42 +08:00
<para > A default installation does not setup a password for the administrator
so here we will set one. Replace <replaceable > [new-password]</replaceable>
with your own.</para>
2002-08-16 09:24:08 +08:00
2003-12-14 01:21:42 +08:00
<!--
2003-09-30 11:14:19 +08:00
<screen > <userinput > <command > mysql -uroot mysql</command> </userinput>
2002-08-16 09:24:08 +08:00
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.51-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
2003-09-30 11:14:19 +08:00
<prompt > mysql> </prompt> <userinput > <command > UPDATE user SET password=password('<replaceable > new-password</replaceable> ') WHERE user='root';</command> </userinput>
2002-08-16 09:24:08 +08:00
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
2003-09-30 11:14:19 +08:00
<prompt > mysql> </prompt> <userinput > <command > FLUSH PRIVILEGES;</command> </userinput>
2002-08-16 09:24:08 +08:00
Query OK, 0 rows affected (0.00 sec)
2003-09-30 11:14:19 +08:00
<prompt > mysql> </prompt> <userinput > <command > EXIT;</command> </userinput>
2002-08-16 09:24:08 +08:00
bye
2003-09-30 11:14:19 +08:00
</screen>
2003-12-14 01:21:42 +08:00
-->
2003-12-14 01:37:20 +08:00
<screen > <userinput > <command > mysqladmin -u root password <replaceable > [new-password]</replaceable> </command> </userinput> </screen>
2002-08-16 09:24:08 +08:00
<para > Now that we are done with the configuration of the server, we can
shut it down.</para>
2004-01-04 07:25:37 +08:00
<screen > <userinput > <command > mysqladmin -p shutdown</command> </userinput> </screen>
2002-08-16 09:24:08 +08:00
2004-03-28 09:46:42 +08:00
<para > Install <filename > /etc/rc.d/init.d/mysql</filename>
init script included in the <xref linkend= "intro-important-bootscripts" /> package.</para>
<screen > <userinput > <command > make install-mysql</command> </userinput> </screen>
2002-08-16 09:24:08 +08:00
</sect3>
</sect2>