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

📄 manual_porting.html

📁 这是一部完整的MYSQL中文参考手册,里面详尽的介绍了MYSQL的使用方法.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0074)manual_Porting.html -->
<html>

<head>
<title>MySQL Reference Manual for version 3.23.7-alpha. - G Comments on porting to other 
systems</title>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type">
<!-- This HTML file has been created by texi2html 1.52 (hacked by david@detron.se)
     from /dr1/my/masters/mysql-3.23/Docs/manual.texi on 9 December 1999 -->
<meta content="Microsoft FrontPage 3.0" name="GENERATOR">
</head>

<body bgColor="#ffffff" link="#101090" text="#000000" vLink="#7030b0">

<p>Go to the <a href="manual_Introduction.html">first</a>, <a href="manual_TODO.html">previous</a>, 
<a href="manual_Regexp.html">next</a>, <a href="manual_Concept_Index.html">last</a> 
section, <a href="manual_toc.html">table of contents</a>. </p>

<hr>

<h1><a href="manual_toc.html#Porting" name="Porting">G Comments on porting to other 
systems</a></h1>

<p>A working Posix thread library is needed for the server. On Solaris 2.5 we use SUN 
PThreads (the native thread support in 2.4 and earlier versions are not good enough) and 
on Linux we use LinuxThreads by Xavier Leroy, <a href="mailto:Xavier.Leroy@inria.fr">Xavier.Leroy@inria.fr</a>. 
</p>

<p>The hard part of porting to a new Unix variant without good native thread support is 
probably to port MIT-pthreads. See <tt>`mit-pthreads/README'</tt> and <a
href="http://www.humanfactor.com/pthreads/">Programming POSIX Threads</a>. </p>

<p>The <strong>MySQL</strong> distribution includes a patched version of Provenzano's 
Pthreads from MIT (see <a href="http://www.mit.edu:8001/people/proven/pthreads.html">MIT 
Pthreads web page</a>). This can be used for some operating systems that do not have POSIX 
threads. </p>

<p>It is also possible to use another user level thread package named FSU Pthreads (see <a
href="http://www.informatik.hu-berlin.de/~mueller/pthreads.html">FSU Pthreads home page</a>). 
This implementation is being used for the SCO port. </p>

<p>See the <tt>`thr_lock.c'</tt> and <tt>`thr_alarm.c'</tt> programs in the <tt>`mysys'</tt> 
directory for some tests/examples of these problems. </p>

<p>Both the server and the client need a working C++ compiler (we use <code>gcc</code> and 
have tried SparcWorks). Another compiler that is known to work is the Irix <code>cc</code>. 
</p>

<p>To compile only the client use <code>./configure --without-server</code>. </p>

<p>There is currently no support for only compiling the server. Nor is it likly to be 
added unless someone has a good reason for it. </p>

<p>If you want/need to change any <tt>`Makefile'</tt> or the configure script you must get 
Automake and Autoconf. We have used the <code>automake-1.2</code> and <code>autoconf-2.12</code> 
distributions. </p>

<p>All steps needed to remake everything from the most basic files. </p>

<pre>/bin/rm */.deps/*.P
/bin/rm -f config.cache
aclocal
autoheader
aclocal
automake
autoconf
./configure --with-debug --prefix='your installation directory'

# The makefiles generated above need GNU make 3.75 or newer.
# (called gmake below)
gmake clean all install init-db
</pre>

<p>If you run into problems with a new port, you may have to do some debugging of <strong>MySQL</strong>! 
See section <a href="manual_Porting.html#Debugging_server">G.1 Debugging a MySQL server</a>. 
</p>

<p><strong>Note:</strong> Before you start debugging <code>mysqld</code>, first get the 
test programs <code>mysys/thr_alarm</code> and <code>mysys/thr_lock</code> to work. This 
will ensure that your thread installation has even a remote chance to work! </p>

<h2><a href="manual_toc.html#Debugging_server" name="Debugging_server">G.1 Debugging a 
MySQL server</a></h2>

<p>If you are using some functionality that is very new in <strong>MySQL</strong>, you can 
try to run mysqld with the <code>--skip-new</code> (which will disable all new, 
potentially unsafe functionality) or with <code>--safe-mode</code> which disables a lot of 
optimization that may cause problems. See section <a href="manual_Problems.html#Crashing">18.1 
What to do if MySQL keeps crashing</a>. </p>

<p>If <code>mysqld</code> doesn't want to start, you should check that you don't have any <code>my.cnf</code> 
file that interferes with your setup! You can check your <code>my.cnf</code> arguments 
with <code>mysqld --print-defaults</code> and avoid using them by starting with <code>mysqld 
--no-defaults ...</code>. </p>

<p>If you have some very specific problem, you can always try to debug <strong>MySQL</strong>. 
To do this you must configure <strong>MySQL</strong> with the option <code>--with-debug</code>. 
You can check whether or not <strong>MySQL</strong> was compiled with debugging by doing: <code>mysqld 
--help</code>. If the <code>--debug</code> flag is listed with the options then you have 
debugging enabled. <code>mysqladmin ver</code> also lists the <code>mysqld</code> version 
as <code>mysql ... -debug</code> in this case. </p>

<p>If you are using gcc or egcs, the recommended configure line is: </p>

<pre>CC=gcc CFLAGS=&quot;-O6&quot; CXX=gcc CXXFLAGS=&quot;-O6 -felide-constructors -fno-exceptions -fno-rtti&quot; ./configure --prefix=/usr/local/mysql --with-debug
</pre>

<p>This will avoid problems with the libstdc++ library and with C++ exceptions. </p>

<p>If you can cause the <code>mysqld</code> server to crash quickly, you can try to create 
a trace file of this: </p>

<p>Start the <code>mysqld</code> server with a trace log in <tt>`/tmp/mysql.trace'</tt>. 
The log file will get very <em>BIG</em>. </p>

<p><code>mysqld --debug --log</code> </p>

<p>or you can start it with </p>

<p><code>mysqld --debug=d,info,error,query,general,where:O,/tmp/mysql.trace</code> </p>

<p>which only prints information with the most interesting tags. </p>

<p>When you configure <strong>MySQL</strong> for debugging you automatically enable a lot 
of extra safety check functions that monitor the health of <code>mysqld</code>. If they 
find something ``unexpected,'' an entry will be written to <code>stderr</code>, which <code>safe_mysqld</code> 
directs to the error log! This also means that if you are having some unexpected problems 
with <strong>MySQL</strong> and are using a source distribution, the first thing you 
should do is to configure <strong>MySQL</strong> for debugging! (The second thing, of 
course, is to send mail to <a href="mailto:mysql@lists.mysql.com">mysql@lists.mysql.com</a> 
and ask for help. Please use the <code>mysqlbug</code> script for all bug reports or 
questions regarding the <strong>MySQL</strong> version you are using! </p>

<p>On most system you can also start <code>mysqld</code> from <code>gdb</code> to get more 
information if <code>mysqld</code> crashes. </p>

<p>With some <code>gdb</code> versions on Linux you must use <code>run --one-thread</code> 
if you want to be able to debug <code>mysqld</code> threads. In this case you can only 
have one thread active at a time. </p>

<p>If you are using gdb 4.17.x on Linux, you should install a <tt>`.gdb'</tt> file, with 
the following information, in your current directory: </p>

<pre>set print sevenbit off
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint
handle SIGWAITING nostop noprint
handle SIGLWP nostop noprint
handle SIGPIPE nostop
handle SIGALRM nostop
handle SIGHUP nostop
handle SIGTERM nostop noprint
</pre>

<p>Here follows an example how to debug mysqld: </p>

<pre>shell&gt; gdb /usr/local/libexec/mysqld
gdb&gt; run
...
back   # Do this when mysqld crashes
info locals
up
info locals
up
...
(until you get some information about local variables)

quit
</pre>

<p>Include the above output in a mail generated with <code>mysqlbug</code> and mail this 
to <code>mysql@lists.mysql.com</code>. </p>

<p>If <code>mysqld</code> hangs you can try to use some system tools like <code>strace</code> 
or <code>/usr/proc/bin/pstack</code> to examine where <code>mysqld</code> has hanged. </p>

<p>If <code>mysqld</code> starts to eat up CPU or memory or if it ``hangs'', you can use <code>mysqladmin 
processlist status</code> to find out if someone is executing some query that takes a long 
time. It may be a good idea to run <code>mysqladmin -i10 processlist status</code> in some 
window if you are experiencing performance problems or problems when new clients can't 
connect. </p>

<p>If <code>mysqld</code> dies or hangs, you should start <code>mysqld</code> with <code>--log</code>. 
When <code>mysqld</code> dies again, you can check in the log file for the query that 
killed <code>mysqld</code>. Note that before starting <code>mysqld</code> with <code>--log</code> 
you should check all your tables with <code>myisamchk</code>. See section <a
href="manual_Maintenance.html#Maintenance">13 Maintaining a MySQL installation</a>. </p>

<p>If you are using a log file, <code>mysqld --log</code>, you should check the 'hostname' 
log files, that you can find in the database directory, for any queries that could cause a 
problem. Try the command <code>EXPLAIN</code> on all <code>SELECT</code> statements that 
takes a long time to ensure that mysqld are using indexes properly. See section <a
href="manual_Reference.html#EXPLAIN">7.22 <code>EXPLAIN</code> syntax (Get information 
about a <code>SELECT</code>)</a>. You should also test complicated queries that didn't 
complete within the <code>mysql</code> command line tool. </p>

<p>If you find the text <code>mysqld restarted</code> in the error log file (normally 
named <tt>`hostname.err'</tt>) you have probably found a query that causes <code>mysqld</code> 
to fail. If this happens you should check all your tables with <code>myisamchk</code> (see 
section <a href="manual_Maintenance.html#Maintenance">13 Maintaining a MySQL installation</a>), 
and test the queries in the <strong>MySQL</strong> log files if someone doesn't work. If 
you find such a query, try first upgrading to the newest <strong>MySQL</strong> version. 
If this doesn't help and you can't find anything in the <code>mysql</code> mail archive, 

⌨️ 快捷键说明

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