source: content/databases/mysql/mysql-config.xml@ 9dcba70

10.0 10.1 11.0 11.1 11.2 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk upgradedb v5_0 v5_0-pre1 v5_1 v5_1-pre1 xry111/intltool xry111/soup3 xry111/test-20220226
Last change on this file since 9dcba70 was 9dcba70, checked in by Larry Lawrence <larry@…>, 19 years ago

Igor's patches for nano, pciutils, GTK2 and MySQL

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1039 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 3.5 KB
Line 
1<sect2>
2<title>Configuring MySQL</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>
18</userinput></screen>
19
20<para>We can now install a database and change the ownership to the
21unpriviledged user and group.</para>
22
23<screen><userinput><command>mysql_install_db
24chown -R mysql:mysql /var/lib/mysql</command></userinput></screen>
25
26<para>Further configuration requires that the mysql server be running:</para>
27
28<screen><userinput><command>mysqld_safe --user=mysql 2&gt;&amp;1 &gt;/dev/null &amp;</command>
29</userinput></screen>
30
31<para>A default installation, does not setup a password for the administrator.
32So here we will login and set one. We strongly suggest changing
33'new-password' to your own.</para>
34
35<screen><userinput><command>mysql -uroot mysql
36Welcome to the MySQL monitor. Commands end with ; or \g.
37Your MySQL connection id is 2 to server version: 3.23.51-log
38
39Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
40
41mysql&gt; UPDATE user SET password=password('new-password') WHERE user='root';
42Query OK, 2 rows affected (0.00 sec)
43Rows matched: 2 Changed: 2 Warnings: 0
44
45mysql&gt; FLUSH PRIVILEGES;
46Query OK, 0 rows affected (0.00 sec)
47
48mysql&gt; EXIT;
49bye
50</command></userinput></screen>
51
52<para>Now that we are done with the configuration of the server, we can
53shut it down.</para>
54
55<screen><userinput><command>kill `pidof -x mysqld_safe mysqld`</command></userinput></screen>
56
57
58<sect4>
59<title>MySQL init.d script</title>
60
61<para>To automate the running of MySQL, use the following command to create
62the init.d script:</para>
63
64<screen><userinput><command>cat &gt; /etc/rc.d/init.d/mysql &lt;&lt; "EOF"
65#!/bin/bash
66# Begin $rc_base/init.d/
67
68# Based on sysklogd script from LFS-3.1 and earlier.
69# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
70
71source /etc/sysconfig/rc
72source $rc_functions
73
74case "$1" in
75 start)
76 echo "Starting MySQL daemon..."
77 /usr/bin/mysqld_safe --user=mysql 2&gt;&amp;1 &gt;/dev/null &amp;
78 evaluate_retval
79 ;;
80
81 stop)
82 echo "Stopping MySQL daemon..."
83 killproc mysqld
84 ;;
85
86 restart)
87 $0 stop
88 sleep 1
89 $0 start
90 ;;
91
92 status)
93 statusproc /usr/sbin/mysqld
94 ;;
95
96 *)
97 echo "Usage: $0 {start|stop|restart|status}"
98 exit 1
99 ;;
100esac
101
102# End $rc_base/init.d/
103EOF
104chmod 755 /etc/rc.d/init.d/mysql</command></userinput></screen>
105
106<para>Create the symbolic links to this file in the relevant
107<filename class="directory">rc.d</filename> directory
108with the following commands:</para>
109
110<screen><userinput><command>cd /etc/rc.d/init.d &amp;&amp;
111ln -sf ../init.d/mysql ../rc0.d/K26mysql &amp;&amp;
112ln -sf ../init.d/mysql ../rc1.d/K26mysql &amp;&amp;
113ln -sf ../init.d/mysql ../rc2.d/K26mysql &amp;&amp;
114ln -sf ../init.d/mysql ../rc3.d/S34mysql &amp;&amp;
115ln -sf ../init.d/mysql ../rc4.d/S34mysql &amp;&amp;
116ln -sf ../init.d/mysql ../rc5.d/S34mysql &amp;&amp;
117ln -sf ../init.d/mysql ../rc6.d/K26mysql</command></userinput></screen>
118
119</sect4>
120
121</sect3>
122
123</sect2>
Note: See TracBrowser for help on using the repository browser.