Gentoo Archives: gentoo-doc-cvs

From: Xavier Neys <neysx@×××××××××××.org>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] cvs commit: mysql-upgrade-slotted.xml
Date: Fri, 10 Mar 2006 23:09:36
Message-Id: 200603102309.k2AN9Roa007529@robin.gentoo.org
1 neysx 06/03/10 23:09:26
2
3 Modified: mysql-upgrade-slotted.xml
4 Log:
5 #125599 Unslotting slotted Mysql
6
7 Revision Changes Path
8 1.10 xml/htdocs/doc/en/mysql-upgrade-slotted.xml
9
10 file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/mysql-upgrade-slotted.xml?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=gentoo
11 plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/mysql-upgrade-slotted.xml?rev=1.10&content-type=text/plain&cvsroot=gentoo
12 diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/mysql-upgrade-slotted.xml.diff?r1=1.9&r2=1.10&cvsroot=gentoo
13
14 Index: mysql-upgrade-slotted.xml
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-upgrade-slotted.xml,v
17 retrieving revision 1.9
18 retrieving revision 1.10
19 diff -u -r1.9 -r1.10
20 --- mysql-upgrade-slotted.xml 17 Feb 2006 19:01:06 -0000 1.9
21 +++ mysql-upgrade-slotted.xml 10 Mar 2006 23:09:26 -0000 1.10
22 @@ -1,306 +1,96 @@
23 <?xml version='1.0' encoding="UTF-8"?>
24 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
25 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-upgrade-slotted.xml,v 1.9 2006/02/17 19:01:06 nightmorph Exp $ -->
26 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-upgrade-slotted.xml,v 1.10 2006/03/10 23:09:26 neysx Exp $ -->
27
28 <guide link="/doc/en/mysql-upgrade-slotted.xml">
29 -<title>Slotted MySQL Upgrade and Migration Guide</title>
30 +<title>"Unslotting" a slotted MySQL Installation</title>
31
32 <author title="Author">
33 <mail link="vivo@g.o">Francesco Riosa</mail>
34 </author>
35 <author title="Editor">
36 - <mail link="chriswhite@g.o">Chris White</mail>
37 -</author>
38 -<author title="Editor">
39 - <mail link="jkt@g.o">Jan Kundrát</mail>
40 -</author>
41 -<author title="Editor">
42 - <mail link="nightmorph@g.o">Joshua Saddler</mail>
43 + <mail link="neysx@g.o">Xavier Neys</mail>
44 </author>
45
46 <abstract>
47 -This document describes the upgrade path to the new slotted MySQL. It strives to
48 -make the upgrade as painless and friendly as possible.
49 +This document describes how to go back to an unslotted MySQL.
50 </abstract>
51
52 <!-- The content of this document is licensed under the CC-BY-SA license -->
53 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
54 <license/>
55
56 -<version>5</version>
57 -<date>2006-02-17</date>
58 +<version>6</version>
59 +<date>2006-03-10</date>
60
61 <chapter>
62 -<title>Upgrading Older MySQL Versions</title>
63 +<title>Upgrading to an unslotted MySQL version from a slotted one</title>
64 <section>
65 +<title>Introduction</title>
66 <body>
67
68 <p>
69 -This document covers how to upgrade to the latest available MySQL version. There
70 -are currently three versions of MySQL supported in Portage:
71 +Due to the negative response from our user base, the MySQL team has decided to
72 +go back to unslotted MySQL. In other words, installing different versions of
73 +MySQL on the same system is not supported anymore.
74 </p>
75
76 -<ul>
77 - <li>
78 - 5.0 follows upstream releases in the stable tree and is actively maintained
79 - </li>
80 - <li>
81 - 4.1 follows upstream releases by implementing major bugfixes and security
82 - fixes, but no new features are added
83 - </li>
84 - <li>4.0 contains security fixes only</li>
85 -</ul>
86 -
87 <p>
88 -There are two additional versions present, but are currently unsupported. This
89 -means that they may lack certain functionalities, and bug reports have very low
90 -priority. This document is not guaranteed to work with the following versions:
91 +If you had upgraded to the slotted version, this guide should help you upgrade
92 +to the unslotted version.
93 </p>
94
95 -<ul>
96 - <li>3.23 has been deprecated</li>
97 - <li>5.1 is currently under heavy development</li>
98 -</ul>
99 -
100 -<note>
101 -<c>mysql-4.0.26</c> will be used as the starting point, and
102 -<c>mysql-5.0.18-r30</c> as the target version. Replace any of these versions
103 -with your own.
104 -</note>
105 -
106 </body>
107 </section>
108 -</chapter>
109 -
110 -
111 -<chapter id="install_the_new_version">
112 -<title>Installing the New Version</title>
113 <section>
114 +<title>"Unslotting"</title>
115 <body>
116
117 <p>
118 -This step will require (re)moving some files from the running environment, so
119 -the first thing to do is backup the running database <e>server</e>, not the
120 -data. Once this is done, it's possible to remove the conflicting files with the
121 -slotted MySQL, and install the new version side by side with the current one.
122 +The following script should do most of the work:
123 </p>
124
125 -<pre caption="Backing up the older version and preparing the installation">
126 -# <i>quickpkg dev-db/mysql</i>
127 -# <i>rm -rf /usr/include/mysql /usr/bin/mysql_config</i>
128 -# <i>for tmpfile in /usr/lib/*mysql*
129 - do
130 - mv "${tmpfile}" "${tmpfile}.TMP"
131 - ln -s "${tmpfile}.TMP" "${tmpfile}"
132 - done</i>
133 -# <i>emerge -av =dev-db/mysql-5.0.18-r30</i>
134 -</pre>
135 +<pre caption='"Unslotting" script'>
136 +<i>echo " building a unslotted copy of mysql "
137 +emerge --buildpkgonly '=dev-db/mysql-5.0.18-r60'
138
139 -<p>
140 -Be sure to run <c>etc-update</c> or <c>dispatch-conf</c> in order to update the
141 -<path>/etc/init.d/mysql</path> startup script.
142 -</p>
143 +echo " stopping the server "
144 +/etc/init.d/mysql stop
145
146 -</body>
147 -</section>
148 -</chapter>
149 +echo " removing most of symlinks "
150 +eselect mysql remove
151
152 -<chapter>
153 -<title>Copying Data to the New Server</title>
154 -<section>
155 -<body>
156 +echo " config files "
157 +mv /etc/mysql /etc/mysql.old
158 +mv /etc/mysql-500 /etc/mysql
159
160 -<p>
161 -Now we'll go ahead and dump the data. This will be imported into the new version
162 -of MySQL. <c>mysqldump</c> will be used from the <b>slotted</b> MySQL. Notice
163 -the <c>-500</c> suffix to the <c>mysqldump</c> program name. This indicates it's
164 -from the <b>5.0</b>.x version.
165 -</p>
166 +echo " removal of remaining symlinks, and eselect stuff "
167 +rm /usr/lib/mysql /usr/include/mysql /usr/bin/mysql_config /usr/lib/libmysql*
168 +rm -rf /var/lib/eselect/mysql/ /usr/lib/mysql-[45]0[01]
169
170 -<impo>
171 -If you are upgrading between version revisions (ie. <c>dev-db/mysql-5.0.18</c>
172 -to <c>dev-db/mysql-5.0.18-r30</c>), you can simply stop the database, move from
173 -one data directory to the other, and restart the server. This allows you to
174 -skip this section entirely.
175 -</impo>
176 -
177 -<pre caption="Dump of all databases">
178 -# <i>mysqldump-500 \
179 - --defaults-file=/etc/mysql/my.cnf \
180 - --user=root \</i>
181 - <comment>(Replace 'your_password' with your MySQL root password)</comment>
182 - <i>--password='your_password' \
183 - --host=localhost \
184 - --all-databases \
185 - --opt \
186 - --allow-keywords \
187 - --flush-logs \
188 - --hex-blob \
189 - --master-data \ <comment>(If binary logs are enabled, use --master-data=0 instead)</comment>
190 - --max_allowed_packet=16M \
191 - --quote-names \
192 - --result-file=BACKUP_MYSQL_4.0.SQL</i>
193 -</pre>
194 -
195 -<p>
196 -A file named <path>BACKUP_MYSQL_4.0.SQL</path> is created, which can be used to
197 -recreate your data. The data is described in the MySQL dialect of SQL, the
198 -Structured Query Language.
199 -</p>
200 -
201 -<p>
202 -Start the server without networking and user management and run the SQL script:
203 -</p>
204 -
205 -<pre caption="Loading the data">
206 -# <i>mv /etc/conf.d/mysql /etc/conf.d/mysql.orig</i>
207 -# <i>cat &lt;&lt;- EOF &gt; /etc/conf.d/mysql
208 - NOCHECK=1
209 - DEBUG=3
210 - mysql_slot_500=(
211 - "skip-networking"
212 - "skip-grant-tables"
213 - "socket=/tmp/mysqld.sock"
214 - )
215 - EOF</i>
216 -# <i>/etc/init.d/mysql start</i>
217 -# <i>mysql-500 --defaults-file=/etc/mysql-500/my.cnf --socket=/tmp/mysqld.sock &lt; BACKUP_MYSQL_4.0.SQL</i>
218 -# <i>/etc/init.d/mysql stop</i>
219 -# <i>mv /etc/conf.d/mysql.orig /etc/conf.d/mysql</i>
220 -</pre>
221 -
222 -<note>
223 -To convert the data to UTF-8 during this step, you <e>must</e> remove
224 -<c>--hex-blob</c> from the <c>mysqldump</c> option, then filter the data through
225 -a converter like <c>iconv</c>. In most cases this is done by simply "piping" it
226 -like so: <c>iconv -f ISO_8859-1 -t UTF8 BACKUP_MYSQL_4.0.SQL | mysql-500
227 ---defaults-file=/etc/mysql-500/my.cnf</c>. Manual adjustments of the SQL file
228 -could be required, depending on the structure and the data contained within.
229 -</note>
230 -
231 -<p>
232 -If there are applications still <e>writing</e> to the previous database, it's
233 -possible to setup a "Replication" relationship between the two databases.
234 -However, this document does not cover that procedure.
235 -</p>
236 -
237 -</body>
238 -</section>
239 -</chapter>
240 -
241 -<chapter>
242 -<title>Migrating to the New Server</title>
243 -<section>
244 -<body>
245 -
246 -<p>
247 -Please test applications against the newly installed server to make sure they
248 -work with it. Quite often every application has configuration settings to choose
249 -which port or socket to use for connecting to the database server. Simply start
250 -the server on an alternate port (for example 3307) and tell your application (or
251 -a test copy of it) to connect with those parameters. Please note that most
252 -applications will try to use the parameters found in the <c>[client]</c> section
253 -of <path>/etc/mysql/my.cnf</path> config file.
254 -</p>
255 -
256 -<p>
257 -Before you switch to the new MySQL server, you will have to adjust the following
258 -variable inside the <path>/etc/conf.d/mysql</path>. Its value might be empty:
259 -</p>
260 -
261 -<pre caption="Adjusting the mysql_slot_500 variable">
262 -# <i>nano -w /etc/conf.d/mysql</i>
263 -<comment>(Add the following line:)</comment>
264 -<i>mysql_slot_500=( )</i>
265 -</pre>
266 -
267 -<p>
268 -When you're satisfied with the results, remove every test setting, stop the old
269 -server and start the new one:
270 -</p>
271 -
272 -<pre caption="Using the new server">
273 -# <i>killall mysqld</i>
274 -# <i>/etc/init.d/mysql stop zap start</i>
275 -</pre>
276 -
277 -<p>
278 -Next, unmerge the old version and make the new one the default. The unmerge
279 -command will be unable to remove some files, such as the ones moved in <uri
280 -link="#install_the_new_version">Code Listing 2.1</uri>. This is an intended
281 -behavior, and is meant to avoid breaking applications linked to the old MySQL
282 -version.
283 -</p>
284 -
285 -<pre caption="Cleanup the old version">
286 -# <i>emerge --unmerge --pretend mysql</i>
287 -# <i>emerge --unmerge =dev-db/mysql-4.0.26</i>
288 -# <i>cd /etc</i>
289 -# <i>mv mysql mysql.$(date +%F_%H-%M)</i>
290 -# <i>rm -rf /usr/lib/*.TMP</i>
291 -# <i>for i in /usr/lib/*mysql*
292 - do
293 - [[ -z "$( readlink -f $i )" ]] &amp;&amp; [[ -L $i ]] &amp;&amp; rm $i
294 - done</i>
295 -
296 -<comment>(emerge app-admin/eselect-mysql if you haven't already)</comment>
297 -# <i>eselect mysql list</i>
298 -# <i>eselect mysql set 1</i>
299 -# <i>eselect mysql show</i>
300 -</pre>
301 -
302 -</body>
303 -</section>
304 -</chapter>
305 -
306 -<chapter>
307 -<title>Rebuilding Applications</title>
308 -<section>
309 -<body>
310 -
311 -<p>
312 -After you remove your old MySQL installation, you can install the new version.
313 -Note that <c>revdep-rebuild</c> from <c>app-portage/gentoolkit</c> is necessary
314 -for rebuilding packages linked against MySQL.
315 -</p>
316 -
317 -<pre caption="Rebuilding reverse dependancies">
318 -# <i>revdep-rebuild --soname libmysqlclient.so.12 -- -p -v</i>
319 -# <i>revdep-rebuild --soname libmysqlclient.so.12</i>
320 -</pre>
321 -
322 -<note>
323 -Depending on the older MySQL version, the <path>libmysqlclient.so</path> version
324 -may be <c>10</c>, <c>12</c>, <c>14</c> or <c>15</c>. Please choose the correct
325 -version of the <e>old</e> package.
326 -</note>
327 -
328 -</body>
329 -</section>
330 -</chapter>
331 -
332 -<chapter>
333 -<title>Final Touches</title>
334 -<section>
335 -<body>
336 +echo " unmerge slotted mysql "
337 +emerge -C \
338 +=dev-db/mysql-4.0.26-r30 \
339 +=dev-db/mysql-4.1.15-r30 \
340 +=dev-db/mysql-4.1.16-r30 \
341 +=dev-db/mysql-4.1.18-r30 \
342 +=dev-db/mysql-5.0.15-r30 \
343 +=dev-db/mysql-5.0.16-r30 \
344 +=dev-db/mysql-5.0.17-r30 \
345 +=dev-db/mysql-5.0.18-r30 \
346 +=dev-db/mysql-5.1.3_alpha-r30 \
347 +=dev-db/mysql-5.1.4_alpha-r30 \
348 +=dev-db/mysql-5.1.6_alpha-r30 \
349 +app-admin/eselect-mysql
350
351 -<pre caption="Upgrading the user database">
352 -<comment>(Replace all instances of 'your_password' with your MySQL root password)</comment>
353 -# <i>mysql_fix_privilege_tables-500 \
354 - --defaults-file=/etc/mysql-500/my.cnf \
355 - --user=root \
356 - --password='your_password'</i>
357 -# <i>mysql -uroot -p'your_password' mysql -e "FLUSH PRIVILEGES;"</i>
358 -# <i>for tbl in $( mysql --silent -uroot -p'your_password' -e 'USE mysql ; SHOW TABLES LIKE "help%";' )
359 - do
360 - mysql -uroot -p'your_password' -e "use mysql ; TRUNCATE TABLE ${tbl};"
361 - done</i>
362 -# <i>mysql -uroot -p'your_password' mysql &lt; /usr/share/mysql/fill_help_tables.sql</i>
363 +echo " ready to merge again MySQL "
364 +emerge --usepkgonly '=dev-db/mysql-5.0.18-r60'</i>
365 </pre>
366
367 <p>
368 -If you encounter any problems during the upgrade process, please file a <uri
369 -link="https://bugs.gentoo.org">bug report</uri>.
370 +It is also recommended that you move data directories listed in
371 +<path>/etc/mysql/my.cnf</path>. If you do that, don't forget to edit
372 +<path>/etc/mysql/my.cnf</path> as well.
373 </p>
374
375 </body>
376
377
378
379 --
380 gentoo-doc-cvs@g.o mailing list