/[gentoo]/xml/htdocs/doc/en/mysql-upgrading.xml
Gentoo

Contents of /xml/htdocs/doc/en/mysql-upgrading.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download) (as text)
Sat Mar 11 18:26:30 2006 UTC (11 years, 10 months ago) by nightmorph
Branch: MAIN
Changes since 1.7: +12 -4 lines
File MIME type: application/xml
Added <impo> about binary logfile size in mysql-upgrading, see bug 123861

1 rane 1.1 <?xml version='1.0' encoding="UTF-8"?>
2     <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 nightmorph 1.8 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-upgrading.xml,v 1.7 2006/01/04 11:26:16 neysx Exp $ -->
4 rane 1.1
5     <guide link="/doc/en/mysql-upgrading.xml">
6     <title>Upgrade guide to MySQL 4.1.x</title>
7    
8     <author title="Author">
9     <mail link="citizen428@gentoo.org">Michael Kohl</mail>
10     </author>
11     <author title="Author">
12     <mail link="vivo@gentoo.org">Francesco Riosa</mail>
13     </author>
14    
15     <abstract>
16     The MySQL herd is proud to announce that MySQL 4.1 can now be found in Gentoo's
17     unstable tree (~arch). As the team hopes that it soon will be able to stabilize
18     this ebuild, here's an upgrade path for all willing testers.
19     </abstract>
20    
21     <!-- The content of this document is licensed under the CC-BY-SA license -->
22     <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
23     <license/>
24    
25 nightmorph 1.8 <version>1.7</version>
26     <date>2006-03-11</date>
27 rane 1.1
28     <chapter>
29     <title>Upgrading from old versions of MySQL</title>
30     <section>
31     <body>
32    
33     <p>
34     Users upgrading from an old version (&lt;4.0.24) of MySQL will first have to
35     install MySQL 4.0.25. If you are already running a current version, you can skip
36     this section and continue with the next one.
37     </p>
38    
39     <pre caption="Simple upgrade">
40     # <i>emerge -av --buildpkg "&lt;mysql-4.1"</i>
41     </pre>
42    
43     </body>
44     </section>
45     </chapter>
46    
47     <chapter>
48     <title>Creating a backup of your current data</title>
49     <section>
50     <body>
51    
52     <p>
53 rane 1.2 One of the most important tasks that every database administrator has to perfom
54     is backing up data. Here we go:
55 rane 1.1 </p>
56    
57     <pre caption="Dump of all databases">
58     # <i>mysqldump \</i>
59     <i>-uroot \</i>
60 neysx 1.7 <i>--password=</i><comment>'your_password'</comment><i> \</i>
61 rane 1.1 <i>-hlocalhost \</i>
62     <i>--all-databases \</i>
63     <i>--opt \</i>
64     <i>--allow-keywords \</i>
65     <i>--flush-logs \</i>
66     <i>--hex-blob \</i>
67     <i>--master-data \</i>
68     <i>--max_allowed_packet=16M \</i>
69 rane 1.3 <i>--quote-names \</i>
70 rane 1.1 <i>--result-file=BACKUP_MYSQL_4.0.SQL</i>
71     </pre>
72    
73     <p>
74 rane 1.2 Now a file named <path>BACKUP_MYSQL_4.0.SQL</path> should exist, which later can
75     be used to recreate your data. The data is described in the MySQL dialect of SQL,
76 rane 1.1 the Structured Query Language.
77     </p>
78    
79     <p>
80 rane 1.2 Now would also be a good time to see if the backup you have created is working.
81 rane 1.1 </p>
82    
83     </body>
84     </section>
85     </chapter>
86    
87     <chapter>
88     <title>Upgrading from recent versions of MySQL</title>
89     <section>
90     <body>
91    
92     <p>
93 rane 1.2 If you have skipped step #1, you now have to create a backup package (of the
94 rane 1.1 database server, not the data) of the currently installed version:
95     </p>
96    
97     <pre caption="Binary package backup">
98     # <i>quickpkg dev-db/mysql</i>
99     </pre>
100    
101     <p>
102 rane 1.2 Now it's time to clean out the current version and all of its data:
103 rane 1.1 </p>
104    
105     <pre caption="Uninstall MySQL">
106     # <i>/etc/init.d/mysql stop</i>
107     # <i>emerge -C mysql</i>
108 rane 1.4 # <i>tar cjpvf ~/mysql.$(date +%F_%H-%M).tar.bz2 /etc/mysql/my.cnf /var/lib/mysql/</i>
109 rane 1.1 # <i>ls -l ~/mysql.*</i>
110     # <i>rm -rf /var/lib/mysql/ /var/log/mysql</i>
111     </pre>
112    
113     <note>
114 rane 1.2 Now two different backups should exist: The SQL one, which is portable between
115     various versions of MySQL, and the other one that will allow you to quickly
116     restore your database. This will be covered later in this doc in more detail.
117 rane 1.1 </note>
118    
119     <p>
120     After you got rid of your old MySQL installation, you can now install the new
121     version. Note that <c>revdep-rebuild</c> is necessary for rebuilding packages
122     linking against MySQL.
123     </p>
124    
125     <pre caption="Upgrading the binaries">
126     # <i>emerge -av "&gt;mysql-4.1"</i>
127     # <i>dispatch-conf</i>
128     # <i>revdep-rebuild</i>
129     </pre>
130    
131     <p>
132     Now configure the newly installed version of MySQL and restart the daemon:
133     </p>
134    
135     <pre caption="Configure MySQL 4.1 base setup">
136 neysx 1.5 # <i>emerge --config =mysql-4.1.&lt;micro_version&gt;</i>
137 rane 1.1 # <i>/etc/init.d/mysql start</i>
138     </pre>
139    
140     <p>
141 nightmorph 1.8 Finally you can import the backup you have created during step #2.
142 rane 1.1 </p>
143    
144 nightmorph 1.8 <impo>
145     The default <path>/etc/mysql/my.cnf</path> file sets binary logging
146     (<c>log-bin</c>) by default. This will log every single transaction that
147     modifies data. If run on a very large database (1GB for example), this could
148     create extremely large files that take up disk space rather quickly. If you
149     are low on space, disabling binary logging might be a good idea.
150     </impo>
151    
152 rane 1.1 <pre caption="Importing the SQL backup">
153     # <i>cat BACKUP_MYSQL_4.0.SQL \</i>
154     <i>| mysql \</i>
155     <i>-uroot \</i>
156 neysx 1.7 <i>--password=</i><comment>'your_password'</comment><i> \</i>
157 rane 1.1 <i>-hlocalhost \</i>
158     <i>--max_allowed_packet=16M</i>
159    
160     # <i>mysql_fix_privilege_tables \</i>
161     <i>--defaults-file=/etc/mysql/my.cnf \</i>
162     <i>--user=root \</i>
163 neysx 1.7 <i>--password=</i><comment>'your_password'</comment><i></i>
164 rane 1.1 </pre>
165    
166     <p>
167     If you now restart your MySQL daemon and everything went as expected, you will
168     have a fully working version of 4.1.x! :-)
169     </p>
170    
171     <pre caption="Restart the MySQL instance">
172     # <i>/etc/init.d/mysql restart</i>
173     </pre>
174    
175     <p>
176     If you encountered any problems during the upgrade process, please report them
177     at our <uri link="https://bugs.gentoo.org">Bugzilla</uri>.
178     </p>
179    
180     </body>
181     </section>
182     </chapter>
183    
184     <chapter>
185     <title>Recover the old installation of MySQL 4.0</title>
186     <section>
187     <body>
188    
189     <p>
190 rane 1.2 If you are not happy with MySQL 4.1, it's possible to go back to MySQL 4.0.
191 rane 1.1 </p>
192    
193     <pre caption="Back to the past">
194     # <i>/etc/init.d/mysql stop</i>
195     # <i>emerge -C mysql</i>
196     # <i>rm -rf /var/lib/mysql/ /var/log/mysql</i>
197     # <i>emerge --usepkgonly "&lt;mysql-4.1"</i>
198 rane 1.2 # <i>tar -xjpvf mysql.[tag] -C /</i>
199 rane 1.1 # <i>/etc/init.d/mysql start</i>
200     </pre>
201    
202     </body>
203     </section>
204     </chapter>
205    
206     <chapter>
207     <title>Straight upgrade, not supported, dangerous</title>
208     <section>
209     <body>
210    
211     <p>
212 rane 1.2 Under certain conditions it's possible to directly upgrade to the next major
213     version of MySQL. If you know what you're doing and think that applies to your
214     case, here's a little trick that makes it possible to directly upgrade to
215     MySQl 4.1.
216 rane 1.1 </p>
217    
218     <pre caption="Straight upgrade">
219     # <i>quickpkg dev-db/mysql</i>
220     # <i>/etc/init.d/mysql stop</i>
221     # <i>tar -cjpvf ~/mysql.$(date +%F_%H-%M).tar.bz2 /etc/mysql/my.cnf /var/lib/mysql/</i>
222     # <i>ls -l ~/mysql.*</i>
223     # <i>export MYSQL_STRAIGHT_UPGRADE=1</i>
224     # <i>emerge -av "&gt;mysql-4.1"</i>
225     # <i>unset MYSQL_STRAIGHT_UPGRADE</i>
226     # <i>dispatch-conf</i>
227     # <i>revdep-rebuild</i>
228     # <i>/etc/init.d/mysql start</i>
229     # <i>mysql_fix_privilege_tables --defaults-file=/etc/mysql/my.cnf \</i>
230 neysx 1.7 <i>-uroot --password=</i><comment>'your_password'</comment><i></i>
231     # <i>mysql --database=mysql -uroot --password=</i><comment>'your_password'</comment><i> &lt; /tmp/new_pieces.sql</i>
232 rane 1.1 # <i>/etc/init.d/mysql restart</i> # just to be sure
233     </pre>
234    
235     <p>
236 rane 1.2 Good luck and if something fails, don't say we didn't warn you! ;-)
237 rane 1.1 </p>
238    
239     </body>
240     </section>
241     </chapter>
242    
243     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20