Menu:

Recent Entries

About

Sirius

板工秀勇與阿吉管理中

Categories

xoops [5]
有關模板 [4]
FreeNX [1]
學用Blog [2]
Ubuntu相關 [1]
TinyMCE [3]
MySQL [4]
硬體相關 [2]
系統修改 [4]
Windows相關 [5]
校務系統 [3]
Lifetype系統更新 [10]
IMageMagick [1]
XPress [1]
LightBox [1]
CSS [1]
站務公告 [7]
Plugins套用修改 [3]
設備使用 [1]
Moodle [1]
電腦教室管理 [0]

Links

LiftType教學
- LifeType 線上教學(官網)
- 部落格教室(怡杰老師)
- 阿欣部落
- 阿杰老師部落格教室

Syndicate

RSS 0.90
RSS 1.0
RSS 2.0
Atom 0.3

Version:

andreas01 v1.3

升级 MySQL

sirius | 19 九月, 2007 05:42

MySQL中文網看到這篇有關升級的文章,應該算是最詳盡的了

升级 MySQL(周二, 2006/07/18 - 09:04 — yejr)

作/译者:叶金荣(Email: ),来源:http://imysql.cn,转载请注明作/译者和出处,并且不能用于商业用途,违者必究。

1、概述

通常,从一个发布版本升级到另一个版本时,我们建议按照顺序来升级版本。例如,想要升级 MySQL 3.23 时,先升级到 MySQL 4.0,而不是直接升级到 MySQL 4.1 或 MySQL 5.0。

以下是在升级 MySQL 时需要注意的事项:

在同一个发布系列版本的MySQL间,可以随意拷贝格式文件和数据文件。如果在MySQL运行过程中改变了字符集,就需要对每个MyISAM表执行 "myisamchk -r -q --set-character-set=charset" 命令修复一下。否则的话,索引的排序可能不正确,因为修改了字符集,就可能会改变索引的顺序。

通常情况下,升级到新版本不需要修改任何数据表。请检查MySQL发布事项中提到的升级需要注意的地方,如果发现不能直接升级的话,就先用 mysqldump 将数据导出来,然后再导回去。

如果担心升级失败,就先把旧版本的MySQL改个名字备份起来,以备所需。

同时,升级完之后可能还需要重新编译跟MySQL相关的程序,因为新版本的头文件和库文件可能有改变了。

如果升级后发生问题了,请先检查是否使用了旧的my.cnf配置文件,可以通过执行命令 "mysqld --print-defaults" 来打印出各种配置信息来确认。

升级的时候最好也升级类似Perl的 DBD::mysql 模块,同样,对PHP和Python而言也是一样。

2、从 MySQL 5.0 升级到 MySQL 5.1

从 5.0 升级到 5.1 的时候,必须要升级授权表。否则,可能某些存储过程无法运行。详情请看附录 "mysql_update MySQL升级时检查数据表"。

以下是从 5.0 升级到 5.1 需要注意的事项:

以下是升级到MySQL 5.1之后会发生的一些变化:

服务器部分

SQL分

3、从 MySQL 4.1 升级到 MySQL 5.0

服务器部分

SQL部分

C API部分

4、从 MySQL 4.0 升级到 MySQL 4.1

服务器部分

客户端部分

SQL部分

C API部分

MySQL 4.1中的密码哈希算法做了改进以提升安全性,不过会导致兼容性问题。使用MySQL 4.0及更早版本的客户端库文件会发生问题。

密码处理部分

MySQL 4.1中的密码哈希算法做了改进以提升安全性,不过会导致兼容性问题。使用MySQL 4.0及更早版本的客户端库文件会发生问题。解决办法有:

5、附录

1、) 在Windows平台上升级MySQL步骤:

  1. 备份旧数据
  2. 停止旧服务器
  3. 从windows的系统服务中删掉mysql服务,用如下命令:
    C:> C:mysqlbinmysqld --remove
  4. 用可执行安装文件方式安装mysql,或者解压可直接执行的二进制压缩包来安装
  5. 重新注册mysql服务,用如下命令:
    C:> C:mysqlbinmysqld --install  
  6. 重启服务器
  7. 其他的问题详见上面提到的各种升级中会碰到的情况

2、) 升级授权表

升级授权表之前一定要备份好 mysql 数据库,以备升级失败时使用旧的授权表。

在unix或类unix系统中,运行 mysql_fix_privilege_tables 脚本来升级授权表:

shell> mysql_fix_privilege_tables  

必须在 mysqld 运行着的时候执行这个脚本,它尝试使用 root 帐号来连接服务器;因此,当 root 需要密码时,用如下方式来指定密码:

shell> mysql_fix_privilege_tables --password=root_password  

在 MySQL 4.1之前,则是用如下形式来指定密码:

shell> mysql_fix_privilege_tables root_password

接下来 mysql_fix_privilege_tables 脚本会升级授权表,在这个过程中可能会有一些 Duplicate column name 警告信息,无需理会它们。待它运行完之后,重启一下服务器即可。

在windows平台上,授权表想要升级到4.0.15并不容易。从4.0.15开始,发行版中包含一个sql脚本:mysql_fix_privilege_tables.sql,用 mysql 客户端运行它来升级授权表,运行类似如下命令:

C:> C:mysqlbinmysql -u root -p mysql
mysql> SOURCE C:/mysql/scripts/mysql_fix_privilege_tables.sql

把上面提到的目录改成真实的目录。

3、) 升级同步

请查看我翻译的文档"6.6 升级同步"

4、) mysql_update MySQL升级时检查数据表

每次升级的时候都必须运行 mysql_upgrade 脚本。它检查了当前版本的MySQL下的所有数据库表的不兼容性,就会检查这些表;并且发现有问题时,也会修复这些表。mysql_update 同时升级了系统表,因此可以兼容新的权限机制并且使用新增的权限。

由于 mysql_update 会把检查过和修复过的表都标记上当前的MySQL版本号,因而保证了下一次在同一个MySQL版本下运行这个脚本时,都会再次报告哪些表需要修复或检查。

它还会把MySQL的版本号记录在数据文件目录下的一个文件中:mysql_upgrade.info。这个文件用于标识当前发布版本检查表时哪些表可以略过,检查时想要忽略这个文件,只需附加上 --force 选项。

为了能检查和修复数据表,并且升级系统表,mysql_update 执行了一下命令:

mysqlcheck --check-upgrade --all-databases --auto-repair
mysql_fix_privilege_tables

mysql_update 目前只支持类unix平台;在windows下,需要手工执行 mysqlcheck 命令,升级授权表请看附录"升级授权表"。

执行 mysql_update 时,MySQL服务器必须运行着,它有以下几个参数:

其他的选项诸如 --password[=password] 是要传递给 mysqlcheckmysql_fix_privilege_tables 脚本的,并不是必须的。

Posted in MySQL . 迴響: (72). 引用:(0). 靜態連結網址
«Next post | Previous post»

Comments

  1. 1. เสาเข็มเจาะ  |  04/20,2019 at 09:39

    ทียู อัมรินทร์ บริษัทจำกัด
    ติดต่อ : 02-416-8153 02-416-8154

  2. 2. height increase  |  08/16,2013 at 01:12

    I do that you are going to be elaborating a little more on this theme.
    I am used to a bit more information.

  3. 3. shoe lifts for men  |  08/14,2013 at 04:50

    What an extremely positive and inspiring posting.
    I am always very impressed with your musings. You always post interesting
    info. Keep it up. Keep blogging. looking forward to reading your next posting.

  4. 4. be taller  |  08/08,2013 at 13:38

    Excellent Article, it is fantastic to at last find some worthwhile information on the
    internet, I am greatly pleased to come across a blog that is
    not full of the ubiquitous drivel, many thanks.

  5. 5. shoe lift  |  07/07,2013 at 05:12

    In a more detailed comment, I shall go over some of the reasoning behind
    our choices. Good reasoning here. I really enjoy
    perusing your posts. I have learned a vast amount from them.

  6. 6. height increase  |  07/07,2013 at 04:51

    Fantastic material! Finally someone that knows what they are on about
    and can produce informative blog for us that read
    it. Definitely looking forward to your next offering.

  7. 7. heel lifts  |  07/03,2013 at 08:50

    It is nearly impossible to find blogs that offer such consistently readable and interesting content as is on offer on yours, you deserve the miniscule amount of time it has taken to
    express my appreciation at your hard work. Bless you.

  8. 8. be taller  |  06/28,2013 at 19:51

    Excellent Article! About time somebody that really knows what they are talking about and can also produce
    insightful material for us readers. without doubt looking forward to your next article.

  9. 9. get taller  |  06/28,2013 at 00:10

    The theme of your blog is very fresh, I am certain that the interested parties who will encounter your blogs will definitely take a lot from your content and advice.

  10. 10. shoe lift  |  06/27,2013 at 14:15

    Wonderful material! About time somebody who really knows
    what they are on about and can as well produce common sense blog for us readers.
    Definitely looking forward to your next posting.

  11. 11. flat feet  |  06/25,2013 at 22:41

    When we honestly ask ourselves which person in our lives means the most to us, we often find that it is those who, instead of giving advice, solutions, or
    cures, have chosen rather to share our pain and touch our wounds with
    a warm and tender hand.

  12. 12. height insoles  |  06/25,2013 at 08:59

    The concept of your blog is totally fresh, I am positive that the people that find your blogs will benefit your content and
    points of view.

  13. 13. shoe lifts  |  06/25,2013 at 06:21

    Fantastic post! At last someone who knows what it is all about and can as well produce exellent blog for us the reader.
    Certainly looking forward to your next offering.

  14. 14. heel lifts  |  06/24,2013 at 21:40

    Educational post, it is nice to find worthwhile content on the internet, I am really pleased to find a
    blog that is not full of the normal garbage, many thanks.

  15. 15. banzai816.typepad.com  |  06/11,2013 at 18:00

    Never make friends with people who are above or below you in status.
    Such friendships will never give you any happiness.

  16. 16. Shoe Lifts  |  06/11,2013 at 15:09

    Love is all we have, the only way that each can help
    the other.

  17. 17. Andreas  |  06/10,2013 at 21:58

    It is difficult to find blogs that deliver such consistently readable and informative content as is on
    offer here, you deserve the tiny amount of time it takes to share my appreciation of your hard work.
    Many thanks.

  18. 18. Lucille  |  06/10,2013 at 19:56

    This is a truly inspiring post. I am very impressed by your musings.
    You come up with useful information. Keep it up.
    Keep blogging. looking forward to going through your next blog post.

  19. 19. Jamal  |  06/10,2013 at 19:30

    True friends stab you in the front.

  20. 20. http://Zombie323.typepad.com  |  06/10,2013 at 19:29

    What the world really needs is more love and less paper
    work.

Leave a Reply

發表迴響
 authimage