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

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 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 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb v5_1 v5_1-pre1 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since c55e298 was c55e298, checked in by Igor Živković <igor@…>, 20 years ago

fixed some formatting issues and added missing ampersands to mysql page

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

  • Property mode set to 100644
File size: 5.4 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></userinput></screen>
18
19<para>We can now install a database and change the ownership to the
20unprivileged user and group.</para>
21
22<screen><userinput><command>mysql_install_db &amp;&amp;
23chown -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&gt;&amp;1 &gt;/dev/null &amp;</command></userinput></screen>
28
29<para>A default installation does not setup a password for the administrator
30so here we will set one. Replace <replaceable>[new-password]</replaceable>
31with your own.</para>
32
33<!--
34<screen><userinput><command>mysql -uroot mysql</command></userinput>
35Welcome to the MySQL monitor. Commands end with ; or \g.
36Your MySQL connection id is 2 to server version: 3.23.51-log
37
38Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
39
40<prompt>mysql&gt;</prompt> <userinput><command>UPDATE user SET password=password('<replaceable>new-password</replaceable>') WHERE user='root';</command></userinput>
41Query OK, 2 rows affected (0.00 sec)
42Rows matched: 2 Changed: 2 Warnings: 0
43
44<prompt>mysql&gt;</prompt> <userinput><command>FLUSH PRIVILEGES;</command></userinput>
45Query OK, 0 rows affected (0.00 sec)
46
47<prompt>mysql&gt;</prompt> <userinput><command>EXIT;</command></userinput>
48bye
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
55shut it down.</para>
56
57<screen><userinput><command>mysqladmin -p shutdown</command></userinput></screen>
58
59<para>To automate the running of <application>My<acronym>SQL</acronym></application>, use the following command to create
60the init.d script:</para>
61
62<screen><userinput><command>cat &gt; /etc/rc.d/init.d/mysql &lt;&lt; "EOF"</command>
63#!/bin/bash
64# Begin $rc_base/init.d/
65
66# Based on sysklogd script from LFS-3.1 and earlier.
67# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
68
69source /etc/sysconfig/rc
70source $rc_functions
71
72pid_file=/var/lib/mysql/`/bin/hostname`.pid
73
74case "$1" in
75 start)
76 echo "Starting MySQL daemon..."
77 failure=0
78 if test -f "$pid_file"
79 then
80 if /bin/ps p `cat $pid_file` | grep mysqld &gt;/dev/null
81 then
82 print_status warning running
83 exit 0
84 else
85 rm -f $pid_file
86 if test -f $pid_file
87 then
88 failure=1
89 fi
90 fi
91 fi
92 if [ $failure = 1 ]
93 then
94 print_status failure
95 else
96 /usr/bin/mysqld_safe --user=mysql 2&gt;&amp;1 &gt;/dev/null &amp;
97 evaluate_retval
98 fi
99 ;;
100
101 stop)
102 echo "Stopping MySQL daemon..."
103 if test -s "$pid_file"
104 then
105 kill `cat $pid_file`
106 sleep 1
107 failure=0
108 while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
109 do
110 [ -z "$flags" ]
111 flags=a$flags
112 sleep 1
113 done
114 if [ -s $pid_file ]
115 then failure=1
116 fi
117 (exit $failure)
118 evaluate_retval
119 else
120 print_status warning not_running
121 fi
122 ;;
123
124 restart)
125 $0 stop
126 sleep 1
127 $0 start
128 ;;
129
130 status)
131 statusproc /usr/sbin/mysqld
132 ;;
133
134 *)
135 echo "Usage: $0 {start|stop|restart|status}"
136 exit 1
137 ;;
138esac
139
140# End $rc_base/init.d/
141<command>EOF
142chmod 755 /etc/rc.d/init.d/mysql</command></userinput></screen>
143
144<para>Create the symbolic links to this file in the relevant
145<filename class="directory">rc.d</filename> directory
146with the following commands:</para>
147
148<screen><userinput><command>cd /etc/rc.d/init.d &amp;&amp;
149ln -sf ../init.d/mysql ../rc0.d/K26mysql &amp;&amp;
150ln -sf ../init.d/mysql ../rc1.d/K26mysql &amp;&amp;
151ln -sf ../init.d/mysql ../rc2.d/K26mysql &amp;&amp;
152ln -sf ../init.d/mysql ../rc3.d/S34mysql &amp;&amp;
153ln -sf ../init.d/mysql ../rc4.d/S34mysql &amp;&amp;
154ln -sf ../init.d/mysql ../rc5.d/S34mysql &amp;&amp;
155ln -sf ../init.d/mysql ../rc6.d/K26mysql</command></userinput></screen>
156
157<para>Finally, add this entry to your <filename>ld.so.conf</filename>
158file so that programs which utilize
159<application>My<acronym>SQL</acronym></application> can find its
160libraries:</para>
161
162<screen><userinput><command>echo /usr/lib/mysql &gt;&gt; /etc/ld.so.conf</command></userinput></screen>
163
164</sect3>
165
166</sect2>
Note: See TracBrowser for help on using the repository browser.