⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysql-install.html

📁 complete details about using SQL applications
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<p></p><table class="code">
	<tbody><tr><td>
<pre>[mysqld]
port=<span class="highlight">XXXXX</span>
socket=<span class="highlight">/hw13/d06/accountname</span>/mysql.sock
basedir=<span class="highlight">/hw13/d06/accountname</span>/mysql
datadir=<span class="highlight">/hw13/d06/accountname</span>/mysql/data
old-passwords

[client]
port=<span class="highlight">XXXXX</span>
socket=<span class="highlight">/hw13/d06/accountname</span>/mysql.sock
</pre>
	</td></tr>
</tbody></table>

<p>Replace the two instances of <span class="code"><span class="highlight">XXXXX</span></span> with a number between 1024 and 65000 (use
the same number both times).  Write the number down if you plan to install <a href="http://www.washington.edu/computing/web/publishing/phpmyadmin.html">phpMyAdmin</a>.  This is the port that MySQL will use to listen for
connections.</p>

<p>
<b>Note:</b> You must use a port number that is not already in use.  You can test a
port number by typing <span class="code">telnet localhost XXXXX</span>(again
		replacing XXXXX with the port number).  If it
says "Connection Refused", then you have a good number.  If it says something
ending in "Connection closed by foreign host." then there is already a server
running on that port, so you should choose a different number.
</p>

<p>Replace <span class="code"><span class="highlight">/hw13/d06/accountname</span></span> with the path to your home directory.</p>

<p>
<b>Note:</b> If you're not planning to use <a href="http://dev.mysql.com/doc/mysql/en/innodb.html">the innodb storage
engine</a>, then now is a good time to turn it off.  This will save you some
space and memory.  You can disable innodb by including a line that says <span class="code">skip-innodb</span> underneath the 'old-passwords' line in your
<tt>.my.cnf</tt> file.</p>

<p>Write the file and exit Pico.</p>

<a name="step10"></a>
</li><li>
<p>If you are following the directions to <a href="http://www.washington.edu/computing/web/publishing/mysql-upgrade.html">upgrade an existing version of MySQL</a>, you should now copy your databases back into your new MySQL installation:</p>

<p></p><table class="code">
	<tbody><tr><td>
		rm -R ~/mysql/data<br>
		cp -R ~/mysql-bak/data ~/mysql/data
	</td></tr>
</tbody></table>

<!-- <p>Otherwise, proceed on to the next step.</p> -->

<a name="step11"></a>
</li><li>
<p>You are now ready to start your MySQL server.

</p><p><b>Make sure you are in the web-development environment, in the mysql 
	directory (see steps 1-3)</b>, and type:</p>

<p></p><table class="code">
	<tbody><tr><td>
		./bin/mysqld_safe &amp;
	</td></tr>
</tbody></table>

<p>Be sure to include the ampersand (&amp;) at the end of the command;
it is an instruction to run the process in the background.
If you forget to type it, you won't be able to continue your
terminal session, and you should close your terminal window and open another.
</p>

<p>If everything has gone correctly, a message similar to the following will appear:</p>

<p></p><table class="code">
	<tbody><tr><td>
		[1] 67786<br>
		% Starting mysqld daemon with databases from /hw13/d06/accountname/mysql/data
	</td></tr>
</tbody></table>

<p>If you don't see such a message, MySQL has not started correctly.  Refer to the <a href="#trouble">troubleshooting section</a> at the bottom of this page.</p>

<p>Otherwise, press <tt>[enter]</tt> to return to the shell prompt.
Your MySQL server is now running as a background job and it will keep
running even after you log out.</p>
</li></ol>

<h4>Set up permissions and passwords</h4>

<b>Note:</b> If you are upgrading, you can return to the <a href="http://www.washington.edu/computing/web/publishing/mysql-upgrade.html">upgrade
documentation</a> now. Otherwise, if this is a new MySQL installation, continue
with setting up the permissions and passwords.

<ol start="11">
<a name="step11"></a>
<li>
<p>At this point your MySQL password is still empty. Use the following command to set a new root password:</p>

<p><span class="code">./bin/mysqladmin -u root password <span class="highlight">mypassword</span></span></p>

<p>Replace <span class="code"><span class="highlight">mypassword</span></span> with a password of your choice; do not enclose your password in any quotation marks.</p>

<a name="step12"></a>
</li><li>
<p>You have now created a "root account" and given it a password. This will
enable you to connect to your MySQL server with the built-in command-line MySQL
client using this account and password.</p>

<p>
If you are installing MySQL for the first time, type the following command to connect to the server:</p>

<p><span class="code">./bin/mysql -u root -p</span></p>

<p>You'll be prompted for the MySQL root password. Enter the password you picked in the previous step.</p>

<p></p><table class="code">
	<tbody><tr><td>
<pre>Enter password: <span class="highlight">mypassword</span>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.15-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt; 
</pre>
	</td></tr>
</tbody></table>


<p>At the <span class="code">mysql&gt;</span> prompt, type the commands that follow, replacing <span class="code"><span class="highlight">mypassword</span></span> with the root password.  Press [enter] after each semicolon.</p>

<p></p><table class="code">
	<tbody><tr><td>
<pre>mysql&gt; use mysql;
mysql&gt; delete from user where Host like "%";
mysql&gt; grant all privileges on *.* to root@"%.washington.edu" identified by '<span class="code"><span class="highlight">mypassword</span></span>' with grant option;
mysql&gt; grant all privileges on *.* to root@localhost identified by '<span class="code"><span class="highlight">mypassword</span></span>' with grant option;
mysql&gt; flush privileges;
mysql&gt; exit;</pre>
	</td></tr>
</tbody></table>

<p>This step allows you to connect to your MySQL server as 'root' from any UW computer.</p>

<a name="step13"></a>
</li><li>
<p>Once back at your shell prompt, you can verify that your MySQL server is running with the following command:</p>

<p><span class="code">./bin/mysqladmin -u root -p version</span></p>

<p>You'll be prompted for the root password again.</p>

<p>If MySQL is running, a message similar to the following will be displayed:</p>

<p></p><table class="code">
	<tbody><tr><td>
<pre>./bin/mysqladmin  Ver 8.41 Distrib 4.1.15, for ibm-aix4.3.3.0 on powerpc
Copyright (C) 2000 MySQL AB &amp; MySQL Finland AB &amp; TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          4.1.15-standard
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /hw13/d06/accountname/mysql.sock
Uptime:                 3 min 32 sec

Threads: 1  Questions: 21  Slow queries: 0  Opens: 12  Flush tables: 1  Open
tables: 1  Queries per second avg: 0.099
</pre>

	</td></tr>
</tbody></table>


<a name="step14"></a>
</li><li>
<p>You're done!  A MySQL server is now running in your account and is ready to
accept connections. At this point you can <a href="http://www.washington.edu/computing/web/publishing/mysql-admin.html">learn
about MySQL administration</a> to get more familiar with MySQL, and you can <a href="http://www.washington.edu/computing/web/publishing/phpmyadmin.html">install phpMyAdmin</a> to help you administer your new
database server.</p>

<p>You can delete the file used to install MySQL with the
following command:</p>

<span class="code">rm
~/mysql-standard-4.1.15-ibm-aix4.3.3.0-powerpc.tar.gz</span>

</li></ol>

<!-- TROUBLESHOOTING -->
<a name="trouble"><h3>Troubleshooting</h3></a>

<p><b>Error Logs</b></p>

<p>The MySQL server logs all status and error messages in a file called <tt><i>somehost</i>.err</tt>, where <i>somehost</i> is the name of the host from which a connection was attempted. The file is located in the <tt>mysql/data</tt> directory and contains useful information for debugging problems with your MySQL server.</p>

<p>To see the 10 most recent messages that were logged, cd into the mysql directory and type:</p>

<span class="code">tail -10 ./data/<span class="highlight">somehost</span>.err</span>

<p>Replace <span class="code"><span class="highlight">somehost</span></span>
with <span class="code">vergil01</span> if your site is
hosted on <tt>students.washington.edu</tt>, and <span class="code">ovid11</span> otherwise.</p>

The following are some common errors with their respective fixes:

<ul>
<li><p><b>Misconfigured <tt>~/.my.cnf</tt></b>.</p>
<p>If only the first numeric line appears (you do not see a <tt>"Starting mysqld
daemon..."</tt> message) when you execute <tt>./bin/mysqld_safe
&amp;</tt>, you probably entered at least one incorrect path in your <tt>.my.cnf</tt> file.  Go
back and check your <tt>.my.cnf</tt> entries against your path information.  You
can find your home directory path by typing <span class="code">echo ~</span> or <span class="code">echo
$HOME</span> in the Web Development environment.</p></li>

<li><p><b>Port in use</b>.</p>
<p>If the MySQL server starts but then reports <tt>msqld
daemon ended</tt>, you probably picked a port in step 9 already in use by
someone else.  The error message in <tt><i>somehost</i>.err</tt> will look like this:</p>

<p></p><table class="code">
	<tbody><tr><td>
		mysqld started on  Thu Apr 24 14:56:42 PDT 2002<br>
		020424 14:56:43  Can't start server: Bind on TCP/IP port: Address already in use<br>
		020424 14:56:43  Do you already have another mysqld server running on port: 3306 ?<br>
		020424 14:56:43  Aborting
	</td></tr>
</tbody></table>

<p>To fix this, go back and enter another port number in your <tt>.my.cnf</tt> file.</p></li>

<li><p><b>Incorrect socket path</b>.</p>
<p>You may see a message in <tt><i>somehost</i>.err</tt> similar to the following:</p>

<p></p><table class="code">
	<tbody><tr><td>			
		mysqld started on  Sat Aug 2 09:15:02 PDT 2002<br>
		020802  9:15:02  Can't start server : Bind on unix socket: No such file or directory<br>
		020802  9:15:02  Do you already have another mysqld server running on socket: /hw13/d06/accountname/mysql.sock ?<br>
		020802  9:15:02  Aborting
	</td></tr>
</tbody></table>

<p>In this case, you have incorrectly specified the path to <tt>mysql.sock</tt>
in your home directory. Look at <a href="#step9">step 9</a> and fix your <tt>~/.my.cnf</tt> file.</p>

<p> For more information about MySQL error logging, <a href="http://dev.mysql.com/doc/mysql/en/Error_log.html">see the MySQL Error Log Page</a>. </p>
</li></ul>


<!-- RESOURCES -->
<a name="3"></a><h3>Resources</h3>

<ul>
<li><a href="http://www.mysql.com/articles/mysql_intro.html">An Introduction to MySQL from MySQL.com</a>.
</li><li><a href="http://www.mysql.com/doc/">Official MySQL documentation from MySQL.com</a>.
</li></ul>



<div id="footer"><div id="footerseal">
<a href="http://www.washington.edu/"><img src="mysql-install_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-install_files/CnC_full_UW_Purple-1.gif" alt="Computing &amp; Communications" border="0" height="14" width="202"></a>
</address>
</div>
<div id="address"><address>
<a href="http://depts.washington.edu/cac/">Computing 
&amp; Communications</a><br> 
help@cac.washington.edu<br>
Modified: September 19, 2006
</address>

</div>
</div>


<!--Created by chtml  on Sep 19, 2006 10:27am--></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -