وجدت هذا الشرح لترقيه قواعد البيانات
من يشرح لنا ويترجم هذا
http://www.gentoo.org/doc/en/mysql-upgrading.xml
على هذا الرابط
النص
================
1. Upgrading from old versions of MySQL
Users upgrading from an old version (<4.0.24) of MySQL will first have to install MySQL 4.0.25. If you are already running a current version, you can skip this section and continue with the next one.
Code Listing 1.1: Simple upgrade
# emerge -av --buildpkg "<mysql-4.1"
2. Creating a backup of your current data
One of the most important tasks that every database administrator has to perfom is backing up data. Here we go:
Code Listing 2.1: Dump of all databases
# mysqldump \
-uroot \
--password='your_password' \
-hlocalhost \
--all-databases \
--opt \
--allow-keywords \
--flush-logs \
--hex-blob \
--master-data \
--max_allowed_packet=16M \
--quote-names \
--result-file=BACKUP_MYSQL_4.0.SQL
Now a file named BACKUP_MYSQL_4.0.SQL should exist, which later can be used to recreate your data. The data is described in the MySQL dialect of SQL, the Structured Query Language.
Now would also be a good time to see if the backup you have created is working.
3. Upgrading from recent versions of MySQL
If you have skipped step #1, you now have to create a backup package (of the database server, not the data) of the currently installed version:
Code Listing 3.1: Binary package backup
# quickpkg dev-db/mysql
Now it's time to clean out the current version and all of its data:
Code Listing 3.2: Uninstall MySQL
# /etc/init.d/mysql stop
# emerge -C mysql
# tar cjpvf ~/mysql.$(date +%F_%H-%M).tar.bz2 /etc/mysql/my.cnf /var/lib/mysql/
# ls -l ~/mysql.*
# rm -rf /var/lib/mysql/ /var/log/mysql
Note: Now two different backups should exist: The SQL one, which is portable between various versions of MySQL, and the other one that will allow you to quickly restore your database. This will be covered later in this doc in more detail.
After you got rid of your old MySQL installation, you can now install the new version. Note that revdep-rebuild is necessary for rebuilding packages linking against MySQL.
Code Listing 3.3: Upgrading the binaries
# emerge -av ">mysql-4.1"
# dispatch-conf
# revdep-rebuild
Now configure the newly installed version of MySQL and restart the daemon:
Code Listing 3.4: Configure MySQL 4.1 base setup
# emerge --config =mysql-4.1.<micro_version>
# /etc/init.d/mysql start
Finally you can import the backup you have created during step #2:
Code Listing 3.5: Importing the SQL backup
# cat BACKUP_MYSQL_4.0.SQL \
| mysql \
-uroot \
--password='your_password' \
-hlocalhost \
--max_allowed_packet=16M
# mysql_fix_privilege_tables \
--defaults-file=/etc/mysql/my.cnf \
--user=root \
--password='your_password'
If you now restart your MySQL daemon and everything went as expected, you will have a fully working version of 4.1.x! :-)
Code Listing 3.6: Restart the MySQL instance
# /etc/init.d/mysql restart
If you encountered any problems during the upgrade process, please report them at our Bugzilla.
4. Recover the old installation of MySQL 4.0
If you are not happy with MySQL 4.1, it's possible to go back to MySQL 4.0.
Code Listing 4.1: Back to the past
# /etc/init.d/mysql stop
# emerge -C mysql
# rm -rf /var/lib/mysql/ /var/log/mysql
# emerge --usepkgonly "<mysql-4.1"
# tar -xjpvf mysql.[tag] -C /
# /etc/init.d/mysql start
5. Straight upgrade, not supported, dangerous
Under certain conditions it's possible to directly upgrade to the next major version of MySQL. If you know what you're doing and think that applies to your case, here's a little trick that makes it possible to directly upgrade to MySQl 4.1.
Code Listing 5.1: Straight upgrade
# quickpkg dev-db/mysql
# /etc/init.d/mysql stop
# tar -cjpvf ~/mysql.$(date +%F_%H-%M).tar.bz2 /etc/mysql/my.cnf /var/lib/mysql/
# ls -l ~/mysql.*
# export MYSQL_STRAIGHT_UPGRADE=1
# emerge -av ">mysql-4.1"
# unset MYSQL_STRAIGHT_UPGRADE
# dispatch-conf
# revdep-rebuild
# /etc/init.d/mysql start
# mysql_fix_privilege_tables --defaults-file=/etc/mysql/my.cnf \
-uroot --password='your_password'
# mysql --database=mysql -uroot --password='your_password' < /tmp/new_pieces.sql
# /etc/init.d/mysql restart # just to be sure
Good luck and if something fails, don't say we didn't warn you! ;-)
======================