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

10.0 10.1 11.0 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 ken/refactor-virt krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk v1_0 v5_0 v5_0-pre1 v5_1 v5_1-pre1 xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since e80cc95 was e80cc95, checked in by Larry Lawrence <larry@…>, 19 years ago

config files edit

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

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