1 | <sect2>
|
---|
2 | <title>Configuring <application>My<acronym>SQL</acronym></application></title>
|
---|
3 |
|
---|
4 | <sect3>
|
---|
5 | <title>Config files</title>
|
---|
6 |
|
---|
7 | <para><filename>/etc/my.cnf</filename>, <filename>~/.my.cnf</filename></para>
|
---|
8 |
|
---|
9 | </sect3>
|
---|
10 |
|
---|
11 | <sect3>
|
---|
12 | <title>Configuration Information</title>
|
---|
13 |
|
---|
14 | <para>There are several default configurations file available in
|
---|
15 | <filename class="directory">/usr/share/mysql</filename> which you can use.</para>
|
---|
16 |
|
---|
17 | <screen><userinput><command>cp /usr/share/mysql/my-medium.cnf /etc/my.cnf</command></userinput></screen>
|
---|
18 |
|
---|
19 | <para>We can now install a database and change the ownership to the
|
---|
20 | unprivileged user and group.</para>
|
---|
21 |
|
---|
22 | <screen><userinput><command>mysql_install_db &&
|
---|
23 | chown -R mysql:mysql /var/lib/mysql</command></userinput></screen>
|
---|
24 |
|
---|
25 | <para>Further configuration requires that the mysql server be running:</para>
|
---|
26 |
|
---|
27 | <screen><userinput><command>mysqld_safe --user=mysql 2>&1 >/dev/null &</command></userinput></screen>
|
---|
28 |
|
---|
29 | <para>A default installation does not setup a password for the administrator
|
---|
30 | so here we will set one. Replace <replaceable>[new-password]</replaceable>
|
---|
31 | with your own.</para>
|
---|
32 |
|
---|
33 | <!--
|
---|
34 | <screen><userinput><command>mysql -uroot mysql</command></userinput>
|
---|
35 | Welcome to the MySQL monitor. Commands end with ; or \g.
|
---|
36 | Your MySQL connection id is 2 to server version: 3.23.51-log
|
---|
37 |
|
---|
38 | Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
|
---|
39 |
|
---|
40 | <prompt>mysql></prompt> <userinput><command>UPDATE user SET password=password('<replaceable>new-password</replaceable>') WHERE user='root';</command></userinput>
|
---|
41 | Query OK, 2 rows affected (0.00 sec)
|
---|
42 | Rows matched: 2 Changed: 2 Warnings: 0
|
---|
43 |
|
---|
44 | <prompt>mysql></prompt> <userinput><command>FLUSH PRIVILEGES;</command></userinput>
|
---|
45 | Query OK, 0 rows affected (0.00 sec)
|
---|
46 |
|
---|
47 | <prompt>mysql></prompt> <userinput><command>EXIT;</command></userinput>
|
---|
48 | bye
|
---|
49 | </screen>
|
---|
50 | -->
|
---|
51 |
|
---|
52 | <screen><userinput><command>mysqladmin -u root password <replaceable>[new-password]</replaceable></command></userinput></screen>
|
---|
53 |
|
---|
54 | <para>Now that we are done with the configuration of the server, we can
|
---|
55 | shut it down.</para>
|
---|
56 |
|
---|
57 | <screen><userinput><command>mysqladmin -p shutdown</command></userinput></screen>
|
---|
58 |
|
---|
59 | <para>Install <filename>/etc/rc.d/init.d/mysql</filename>
|
---|
60 | init script included in the <xref linkend="intro-important-bootscripts"/> package.</para>
|
---|
61 |
|
---|
62 | <screen><userinput><command>make install-mysql</command></userinput></screen>
|
---|
63 |
|
---|
64 | </sect3>
|
---|
65 |
|
---|
66 | </sect2>
|
---|