📄 mysql-upgrade.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><title>Upgrading to the Latest Version of MySQL</title>
<link rel="stylesheet" href="mysql-upgrade_files/home.css" type="text/css">
<link rel="stylesheet" href="mysql-upgrade_files/webpub.css" type="text/css">
<style type="text/css">
.highlight { background: #FFFF66 }
</style></head>
<body bgcolor="#ffffff">
<a href="http://www.washington.edu/"><img id="toplogo" src="mysql-upgrade_files/UWlogo150p.gif" alt="University of Washington" border="0"></a>
<div id="toolbar">
<span class="l1text"><a href="http://www.washington.edu/home/search.html">Search</a> |
<a href="http://www.washington.edu/home/directories.html">Directories</a> |
<a href="http://www.lib.washington.edu/research/">Reference
Tools</a></span></div>
<!--Section Banner Table -->
<div class="bannerwrapper">
<div id="topbanner"><img src="mysql-upgrade_files/rib0.gif" alt="" height="16" width="6"></div>
</div>
<div id="crumbs"><span class="l1text"><a href="http://www.washington.edu/">UW Home</a> > <a href="http://www.washington.edu/uwin/">UWIN</a> > <a href="http://www.washington.edu/computing/">Computing and Networking</a> > <a href="http://www.washington.edu/computing/web/">Web</a> > <a href="http://www.washington.edu/computing/web/publishing/">Web Publishing</a> > <a href="http://www.washington.edu/computing/web/publishing/mysql.html">Using MySQL</a></span> </div><div class="forceclear"></div>
<table style="table-layout: fixed;" align="right" bgcolor="#ffffcc" border="1" cellpadding="5" cellspacing="0">
<tbody><tr>
<td width="120">
<p>This article applies to the following UW Web servers:</p>
<center>
<a href="http://faculty.washington.edu/">faculty</a><br>
<a href="http://staff.washington.edu/">staff</a><br>
<a href="http://students.washington.edu/">students</a><br>
<a href="http://courses.washington.edu/">courses</a><br>
<a href="http://depts.washington.edu/">depts</a><br>
</center>
</td>
</tr>
</tbody></table>
<h1>Upgrading to the Latest Version of MySQL</h1>
<h4>Summary</h4>
<p>This page will show you how to remove your old version of MySQL,
install the latest MySQL software in your UW account, and move your
databases over to your new MySQL installation.</p>
<h4>About Version 4.1.15</h4>
<p>As of this writing, the current stable release of MySQL is version
4.1.15. Apart from being more stable, more optimized and more portable,
the MySQL 4.1.15 release has several major features not present in the
3.x
series of releases. The 4.1.x versions of MySQL use a new password
hashing
function that is not compatible with the older client libraries. This
means
that you will have to set your MySQL installation to use the old
password
hashing method, until we get new client libraries installed. The change
that
needs to be made consists of adding a line to your <code>.my.cnf</code> file
that says "old-passwords". This line is included in the <code>.my.cnf</code>
section of the install documentation.
</p>
<p>
Refer to <a href="http://www.mysql.com/doc/en/News-4.1.x.html">the 4.1.x changelog</a> for a list of new additions and bug fixes.</p>
<h4><a name="2">Instructions</a></h4>
<p>The upgrading process can be broken down into three parts:
</p><ul>
<li>Shut down existing server, and back-up files.
</li><li>Install and start new version of MySQL, copying back-up files back into
their original places.
</li><li>Remove back-up files and finish configuring new version of MySQL.
</li></ul>
<h4>Shut down existing server, and back-up files.</h4>
<ol>
<a name="step1"></a>
<li> <p>Log in to your Homer or Dante account with <a href="http://www.washington.edu/computing/software/uwick/teraterm">Tera Term</a>
or another terminal emulator.</p>
<a name="step2"></a>
</li><li><p>Press the O key for Other.</p>
<a name="step3"></a>
</li><li><p>Press the W key to drop into the <a href="http://www.washington.edu/computing/web/publishing/environs.html">Web
development environment</a>. Stay in your home directory; at no
point during this process should you <tt>cd</tt> to <tt>public_html</tt>.</p>
<a name="step4"></a>
</li><li><p>If your MySQL server is running, shut it down. Read the <a href="http://www.washington.edu/computing/web/publishing/mysql-admin.html">Basic MySQL Administration</a> for instructions on doing
this.</p>
<a name="step5"></a>
</li><li><p>If you are using a <tt>.my.cnf</tt> file, temporarily change its name:
</p><p><span class="code">mv ~/.my.cnf ~/.my.cnf.temp</span></p>
<a name="step6"></a>
</li><li><p>Rename your old MySQL symbolic link:</p>
<p><span class="code">mv ~/mysql ~/mysql-bak</span></p>
<p><b>Warning:</b> You must follow this step, or your new MySQL installation will not work properly.</p>
</li></ol>
<h4>Install and start new version of MySQL</h4>
<ol start="7">
<a name="step8"></a>
<li><p>Follow the instructions to <a href="http://www.washington.edu/computing/web/publishing/mysql-install.html">install the latest version of MySQL</a>,
paying attention to the instructions for those upgrading an existing version of MySQL.</p>
</li></ol>
<h4>Remove back-up files and finish configuring new version of MySQL.</h4>
<ol start="8">
<a name="step9"></a>
<li><p>Once you have verified that your new installation is working and that you
successfully copied over your old databases (step 10 of the installation
instructions), you can remove the old MySQL program files:</p>
<p><span class="code">rm -R ~/mysql-bak</span></p>
<a name="step10"></a>
</li><li>
<p><i>Optional</i>: This entire step is not required, and your database will
function fine if you skip it. But, if you are upgrading from a 3.x to a 4.x release of MySQL,
you should consider converting some of your tables to a more current format.
There are two steps:
</p><ol>
<li>This is needed only if you want to use the new <tt>GRANT</tt> functions, <tt>CREATE AGGREGATE
FUNCTION</tt> or want to use the more secure passwords. It is described <a href="http://www.mysql.com/doc/en/Upgrading-grant-tables.html">in the MySQL
documentation</a>.
<p>To do this with your installation, edit the <tt>bin/mysql_fix_privilege_tables</tt> script in your MySQL directory:
</p><p><span class="code">pico -w ~/mysql/bin/mysql_fix_privilege_tables</span>
</p><p>Near the top of this script, you will see this:
</p><p></p><table class="code">
<tbody><tr><td>
<pre>if test -z "$1" ; then
cmd="<span class="highlight">/usr/local/mysql/bin/mysql</span> -f --user=$user --host=$host mysql"
else
root_password="$1"
cmd="<span class="highlight">/usr/local/mysql/bin/mysql</span> -f --user=$user --password=$root_password --host=$host mysql"
fi
</pre>
</td></tr>
</tbody></table>
<p>Change the highlighted text (<span class="code"><span class="highlight">/usr/local/mysql/bin/mysql</span></span>) on both lines to
read simply <span class="code">bin/mysql</span>. It should look like this:
</p><p></p><table class="code">
<tbody><tr><td>
<pre>if test -z "$1" ; then
cmd="<span class="highlight">bin/mysql</span> -f --user=$user --host=$host mysql"
else
root_password="$1"
cmd="<span class="highlight">bin/mysql</span> -f --user=$user --password=$root_password --host=$host mysql"
fi
</pre>
</td></tr>
</tbody></table>
<p>Write the file and exit Pico. Now enter the <tt>mysql</tt> directory and run
the script.
</p><p></p><table class="code">
<tbody><tr><td>
<pre>cd ~/mysql
bin/mysql_fix_privilege_tables <span class="highlight">mypassword</span>
</pre>
</td></tr>
</tbody></table>
<p>Be sure to replace <span class="code"><span class="highlight">mypassword</span></span> with your root password. You will see the
following:
</p><p></p><table class="code">
<tbody><tr><td>
<pre>This scripts updates the mysql.user, mysql.db, mysql.host and the
mysql.func tables to MySQL 3.22.14 and above.
This is needed if you want to use the new GRANT functions,
CREATE AGGREGATE FUNCTION or want to use the more secure passwords in 3.23
If you get 'Access denied' errors, you should run this script again
and give the MySQL root user password as an argument!
Converting all privilege tables to MyISAM format
If your tables are already up to date or partially up to date you will
get some warnings about 'Duplicated column name'. You can safely ignore these!
ERROR 1060 at line 2: Duplicate column name 'File_priv'
<i>...etc...</i>
</pre>
</td></tr>
</tbody></table>
<p><b>Note</b>: The errors you will likely see can be ignored, as this script
explains before generating them.
</p><p>The script may take up to a minute to finish. When it is complete, your database should have had its system tables fixed.
</p></li><li>
Finally, you're also encouraged to convert all your tables
to the new <tt>MyISAM</tt> format. The <a href="http://www.mysql.com/doc/en/Upgrading-from-3.23.html">MySQL upgrade
page</a> discusses this. You can perform this conversion by running the following command from the <tt>mysql/</tt> directory:
<p><span class="code">perl bin/mysql_convert_table_format
--socket=$HOME/mysql.sock --user=root --password='<span class="highlight">mypassword</span>' --verbose <span class="highlight">db_name</span></span></p>
<p>Be sure to use the correct password in place of <span class="code"><span class="highlight">mypassword</span></span>.
Repeat this command for every database in your MySQL installation, replacing
<span class="code"><span class="highlight">db_name</span></span> with the name of each
database.</p>
</li></ol>
</li></ol>
<h4><a name="2">Additional Information</a></h4>
The <a href="http://dev.mysql.com/doc/en/upgrade.html">MySQL upgrade page</a> has important details about using the new software.
<p>You may also want to <a href="http://www.washington.edu/computing/web/publishing/phpmyadmin-upgrade.html">upgrade to the latest version of phpMyAdmin</a>.</p>
<div id="footer"><div id="footerseal">
<a href="http://www.washington.edu/"><img src="mysql-upgrade_files/footersealW.gif" alt="UW Seal"></a>
</div>
<div id="addressright"><address>
A service provided by<br>
<a href="http://depts.washington.edu/cac/"><img src="mysql-upgrade_files/CnC_full_UW_Purple-1.gif" alt="Computing & Communications" border="0" height="14" width="202"></a>
</address>
</div>
<div id="address"><address>
<a href="http://depts.washington.edu/cac/">Computing
& Communications</a><br>
help@cac.washington.edu<br>
Modified: November 7, 2005
</address>
</div>
</div>
<!--Created by chtml on Sep 15, 2006 12:52pm--></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -