Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 78019 Details for
Bug 120210
Migration to slotted MySQL initial document
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
migrate-to-slot.xml
mysql-migrate-to-slot.xml (text/plain), 8.02 KB, created by
Francesco R. (RETIRED)
on 2006-01-24 11:55:49 UTC
(
hide
)
Description:
migrate-to-slot.xml
Filename:
MIME Type:
Creator:
Francesco R. (RETIRED)
Created:
2006-01-24 11:55:49 UTC
Size:
8.02 KB
patch
obsolete
><?xml version='1.0' encoding="UTF-8"?> ><!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> ><!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-upgrading.xml,v 1.7 2006/01/04 11:26:16 neysx Exp $ --> > ><guide link="/doc/en/mysql-upgrading.xml"> ><!-- http://localhost:8008/doc/en/mysql-upgrading.xml --> ><title>MySQL, upgrade and switch to slotted guide</title> > ><author title="Author"> > <mail link="vivo@gentoo.org">Francesco Riosa</mail> ></author> > ><abstract> >Here described there is an upgrade path for MySQL databases as painless as >possible. ></abstract> > ><!-- The content of this document is licensed under the CC-BY-SA license --> ><!-- See http://creativecommons.org/licenses/by-sa/2.5 --> ><license/> > ><version>1.6</version> ><date>2006-01-04</date> > ><chapter> ><title>Upgrading from old versions of MySQL</title> ><section> ><body> > ><p> >This document cover how to upgrade to the latest version available. >There are currently three version of MySQL supported in portage: > ><ul> > <li>5.0 Follow upstream schedule (stable tree, active bugfixing)</li> > <li>4.1 Follow upstream schedule (only changes to a large userbase)</li> > <li>4.0 Security fix only</li> ></ul> > >There are two additional version presently, but are currently unsupported >meaning that bug reports have very low priority any may lack functionalities.<br /> >The current document is not guaranteed to work with them. > ><ul> > <li>3.23 ancient</li> > <li>5.1 active development</li> ></ul> ></p> > ><note> > The present document will use mysql-4.0.26 as start point > and mysql-5.0.18-r30 as the target version<br /> > Replace any of these with your own. ></note> > ></body> ></section> ></chapter> > > ><chapter id="install_the_new_version"> ><title>Install the new version</title> ><section> ><body> > ><p> > This step require to (re)move some files from the running environment, > so the first thing to do is a backup of the running database server, > (still not the data).<br /> > Done that, it's possible to remove the conflicting files with the > slotted MySQL, and install the new version side by side with > the current one. ></p> > ><pre caption="Backup old package and prepare installation"> ># <i>quickpkg dev-db/mysql</i> ># <i>rm -rf /usr/include/mysql /usr/bin/mysql_config</i> ># <i>for tmpfile in /usr/lib/*mysql* ; do</i> > <i> mv "${tmpfile}" "${tmpfile}.TMP"</i> > <i> ln -s "${tmpfile}.TMP" "${tmpfile}"</i> > <i>done</i> ># <i>emerge -av =dev-db/mysql-5.0.18-r30</i> ></pre> > ><p> >Be sure to update the /etc/init.d/mysql startup script with >etc-update or dispatch-conf. ></p> > ></body> ></section> ></chapter> > ><chapter> ><title>Copy the data to the newly installed server</title> ><section> ><body> > ><p> >Lets go to to dump the data, this will be imported in the new version of >mysql.<br /> >We are going to use mysqldump from the <b>slotted</b> MySQL.<br /> >Notice the "<b>-500</b>" suffix to the mysqldump program name, it's from >the <b>5.0</b>.x version. ></p> > ><pre caption="Dump of all databases"> ># <i>mysqldump-500 \</i> > <i>--defaults-file=/etc/mysql/my.cnf</i> > <i>-uroot \</i> > <i>--password=</i><comment>'your_password'</comment><i> \</i> > <i>-hlocalhost \</i> > <i>--all-databases \</i> > <i>--opt \</i> > <i>--allow-keywords \</i> > <i>--flush-logs \</i> > <i>--hex-blob \</i> > <i>--master-data \</i> > <i>--max_allowed_packet=16M \</i> > <i>--quote-names \</i> > <i>--result-file=BACKUP_MYSQL_4.0.SQL</i> ></pre> > ><p> >Now a file named <path>BACKUP_MYSQL_4.0.SQL</path> exist, which can be >used to recreate your data. The data is described in the MySQL dialect of SQL, >the Structured Query Language. ></p> > ><p> >start the server without networking and user management >and run the SQL script: ></p> > ><pre caption="Load data"> ># <i>mv /etc/conf.d/mysql /etc/conf.d/mysql.orig</i> ># <i>echo '</i> > <i>NOCHECK=1</i> > <i>DEBUG=3</i> > <i>mysql_slot_500=(</i> > <i> "skip-networking"</i> > <i> "skip-grant-tables"</i> > <i>)</i> > <i>' > /etc/conf.d/mysql</i> ># <i>/etc/init.d/mysql-500 start</i> ># <i>mysql-500 --defaults-file=/etc/mysql-500/my.cnf < BACKUP_MYSQL_4.0.SQL</i> ># <i>mv /etc/conf.d/mysql.orig /etc/conf.d/mysql</i> ># <i>/etc/init.d/mysql-500 stop</i> ></pre> > ><note> > To convert the data to UTF-8 during this step you MUST remove "--hex-blob" > from the mysqldump option, then filter the data through a converter like > "iconv".<br /> > In most case this is done simply "piping" it like this:<br /> > "iconv -f ISO_8859-1 -t UTF8 BACKUP_MYSQL_4.0.SQL > | mysql-500 --defaults-file=/etc/mysql-500/my.cnf"<br /> > Also manual tweaking of the SQL file could be needed, depending on the > structure and the data contained in it. ></note> > ><note> > If there are applications still <comment>writing</comment> to the previous > database, it's possible to setup a "Replication" relationship between the > two databases, however this will not be covered here. ></note> > ></body> ></section> ></chapter> > > ><chapter> ><title>Switch to the new server</title> ><section> ><body> ><p>If you need to be sure that applications are working with the newly >installed server, please test them against it, quite every application >has configuration settings to chose which port or socket to use to connect >to the database server.<br /> >Simply start the server on an alternate port (for example 3307) and tell your >application or a test copy of it to connect with those parameters.<br /> >Pay attention that most of them will try to use the parameters found in the >"[client]" section of /etc/mysql/my.cnf config file.<br/> ></p> > ><p> >When you're satisfied with the results, remove every testing setting, >stop the old server and start the new one.<br /> >Also make it the server that will start at next reboot. ></p> > ><pre caption="Use the new server"> ># <i>rc-update del mysql default</i> ># <i>rc-update add mysql-500 default</i> ># <i>/etc/init.d/mysql stop</i> ># <i>/etc/init.d/mysql-500 start</i> ></pre> > ><p> >unmerge the old version, and make the new one the default. >The unmerge command will be unable to remove some files, the ones moved in ><uri link="#install_the_new_version">Backup old package and prepare installation</uri> >This is an intended behavior, and avoid breaking application linked to the >old MySQL version. ></p> > ><pre caption="cleanup first step"> ># <i>emerge --unmerge --pretend mysql</i> ># <i>emerge --unmerge "=dev-db/mysql-4.0.26"</i> ># <i>cd /etc</i> ># <i>mv mysql mysql.$(date +%F_%H-%M)</i> ># <i>rm -rf /usr/lib/*.TMP</i> ># <i>rm -rf /usr/lib/*.TMP</i> ># <i>for i in /usr/lib/*mysql* ; do</i> > <i> readlink -f $i || [[ -L $i ]] && rm $i</i> > <i>done</i> ># <i>eselect mysql list</i> ># <i>eselect mysql set 1</i> ># <i>eselect mysql show</i> ></pre> > ></body> ></section> ></chapter> > > ><chapter> ><title>Rebuild applications</title> ><section> ><body> > ><p> >After you got rid of your old MySQL installation, you can now install the new >version. Note that <c>revdep-rebuild</c> is necessary for rebuilding packages >linking against MySQL. ></p> > ><pre caption="Reverse dependancies rebuild"> ># <i>revdep-rebuild --soname libmysqlclient.so.12 -- -p -v</i> ># <i>revdep-rebuild --soname libmysqlclient.so.12</i> ></pre> > ><note> >Depending on which really is the old version libmysqlclient.so number may >be 10, 12, 14 or 15, chose the one of the <comment>old</comment> package. ></note> > ></body> ></section> ></chapter> > > ><chapter> ><title>Final touches</title> ><section> ><body> > ><pre caption="Upgrading user database"> ># <i>mysql_fix_privilege_tables-500 \</i> > <i>--defaults-file=/etc/mysql-500/my.cnf \</i> > <i>--user=root \</i> > <i>--password=</i><comment>'your_password'</comment><i></i> ># <i>mysql -uroot -p</i><comment>'your_password'</comment><i> mysql -e "FLUSH PRIVILEGES;"</i> ># <i>for tbl in $( mysql --silent -uroot -p</i><comment>'your_password'</comment><i> -e 'USE mysql ; SHOW TABLES LIKE "help%";' )</i> > <i>do</i> > <i>mysql -uroot -p</i><comment>'your_password'</comment><i> -e "use mysql ; TRUNCATE TABLE ${tbl};"</i> > <i>done</i> ># <i>mysql -uroot -p</i><comment>'your_password'</comment><i> mysql < /usr/share/mysql/fill_help_tables.sql</i> ></pre> > ><p> >If you encountered any problems during the upgrade process, please report them >at our <uri link="https://bugs.gentoo.org">Bugzilla</uri>. ></p> > ></body> ></section> ></chapter> > ></guide>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 120210
:
78019
|
78040
|
78470
|
78471
|
78478
|
78479
|
78523
|
78525