source: content/databases/mysql/mysql-config.xml@ cf6e240f

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_1 v5_1-pre1 xry111/intltool xry111/soup3 xry111/test-20220226
Last change on this file since cf6e240f was cf6e240f, checked in by Igor Živković <igor@…>, 19 years ago

fixed entities in mysql boot script

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

  • Property mode set to 100644
File size: 4.9 KB
Line 
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>
18</userinput></screen>
19
20<para>We can now install a database and change the ownership to the
21unprivileged 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 set one. Replace <replaceable>[new-password]</replaceable>
33with your own.</para>
34
35<!--
36<screen><userinput><command>mysql -uroot mysql</command></userinput>
37Welcome to the MySQL monitor. Commands end with ; or \g.
38Your MySQL connection id is 2 to server version: 3.23.51-log
39
40Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
41
42<prompt>mysql&gt;</prompt> <userinput><command>UPDATE user SET password=password('<replaceable>new-password</replaceable>') WHERE user='root';</command></userinput>
43Query OK, 2 rows affected (0.00 sec)
44Rows matched: 2 Changed: 2 Warnings: 0
45
46<prompt>mysql&gt;</prompt> <userinput><command>FLUSH PRIVILEGES;</command></userinput>
47Query OK, 0 rows affected (0.00 sec)
48
49<prompt>mysql&gt;</prompt> <userinput><command>EXIT;</command></userinput>
50bye
51</screen>
52-->
53
54<screen><userinput><command>mysqladmin -u root password <replaceable>[new-password]</replaceable></command></userinput></screen>
55
56<para>Now that we are done with the configuration of the server, we can
57shut it down.</para>
58
59<screen><userinput><command>mysqladmin -p shutdown</command></userinput></screen>
60
61<para>To automate the running of <application>My<acronym>SQL</acronym></application>, 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"</command>
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
74pid_file=/var/lib/mysql/`/bin/hostname`.pid
75
76case "$1" in
77 start)
78 echo "Starting MySQL daemon..."
79 if test -s "$pid_file"
80 then print_status warning running
81 else
82 /usr/bin/mysqld_safe --user=mysql 2&gt;&amp;1 &gt;/dev/null &amp;
83 evaluate_retval
84 fi
85 ;;
86
87 stop)
88 echo "Stopping MySQL daemon..."
89 if test -s "$pid_file"
90 then
91 kill `cat $pid_file`
92 sleep 1
93 failure=0
94 while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
95 do
96 [ -z "$flags" ]
97 flags=a$flags
98 sleep 1
99 done
100 if [ -s $pid_file ]
101 then failure=1
102 fi
103 (exit $failure)
104 evaluate_retval
105 else
106 print_status warning not_running
107 fi
108 ;;
109
110 restart)
111 $0 stop
112 sleep 1
113 $0 start
114 ;;
115
116 status)
117 statusproc /usr/sbin/mysqld
118 ;;
119
120 *)
121 echo "Usage: $0 {start|stop|restart|status}"
122 exit 1
123 ;;
124esac
125
126# End $rc_base/init.d/
127<command>EOF
128chmod 755 /etc/rc.d/init.d/mysql</command></userinput></screen>
129
130<para>Create the symbolic links to this file in the relevant
131<filename class="directory">rc.d</filename> directory
132with the following commands:</para>
133
134<screen><userinput><command>cd /etc/rc.d/init.d &amp;&amp;
135ln -sf ../init.d/mysql ../rc0.d/K26mysql &amp;&amp;
136ln -sf ../init.d/mysql ../rc1.d/K26mysql &amp;&amp;
137ln -sf ../init.d/mysql ../rc2.d/K26mysql &amp;&amp;
138ln -sf ../init.d/mysql ../rc3.d/S34mysql &amp;&amp;
139ln -sf ../init.d/mysql ../rc4.d/S34mysql &amp;&amp;
140ln -sf ../init.d/mysql ../rc5.d/S34mysql &amp;&amp;
141ln -sf ../init.d/mysql ../rc6.d/K26mysql</command></userinput></screen>
142
143<para>Finally, add this entry to your <filename>ld.so.conf</filename>
144file so that programs which utilize
145<application>My<acronym>SQL</acronym></application> can find its
146libraries:</para>
147
148<screen><userinput><command>echo /usr/lib/mysql &gt;&gt; /etc/ld.so.conf</command></userinput></screen>
149
150</sect3>
151
152</sect2>
Note: See TracBrowser for help on using the repository browser.