📄 mysql database and linux tutorial.mht
字号:
--host=3D<I>host-name</I> -C <I>database</I></TT> =
</LI></UL></LI></UL>
<P><B>Man Page:</B>=20
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmysqldum=
p">mysqldump</A>=20
</LI></UL>
<P><B>Upgrading to 4.1:</B>=20
<UL>
<LI><A=20
=
href=3D"http://dev.mysql.com/doc/refman/4.1/en/upgrading-from-3-23.html">=
Upgrading=20
mySQL to 4.1 from 3.23</A>=20
<LI>Use the command: <TT>mysql_fix_privilege_tables=20
--password=3D<I>root-password</I></TT> <BR>This allows you to =
use the new=20
<TT>GRANT</TT> command. </LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Restore MySql =
Database:</BIG></B></TD></TR></TBODY></TABLE>
<P>Restore using dump generated by <TT>mysqldump</TT> above:=20
<UL>
<LI><TT>mysql -h <I>host-name</I> -u <I>user-id</I>=20
-p<I>supersecretpassword</I> < =
<I>total-db-dump-file</I>.sql</TT>=20
<LI><TT>mysql <I>database-name</I> -h <I>host-name</I> -u =
<I>user-id</I>=20
-p<I>supersecretpassword</I> < <I>db-dump-file</I>.sql</TT> =
</LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Building MySql from source: (on=20
Linux)</BIG></B></TD></TR></TBODY></TABLE>
<P>Prerequisites:=20
<UL>
<LI>C compiler: 2.95.2 or later. (Check with the command: =
<TT>rpm -q=20
gcc</TT>) </LI></UL>Compile and install: (as root)=20
<UL>
<LI>Downloaded source from <TT><A=20
=
href=3D"http://dev.mysql.com/downloads/mysql/4.1.html">http://dev.mysql.c=
om/downloads/mysql/4.1.html</A></TT>=20
<LI>Expand tar file: <TT>tar xzf mysql-4.1.16.tar.gz</TT>=20
<LI><TT>cd mysql-4.1.16</TT>=20
<LI><TT>./configure --prefix=3D/opt/mysql =
--sysconfdir=3D/opt/etc=20
--localstatedir=3D/opt/var/mysql=20
--with-unix-socket-path=3D/opt/tmp/mysql.sock</TT> <BR>(Use the =
command=20
<TT>./configure --help</TT> to see all options.) <BR>This should =
create=20
an installation which will not clobber an existing RPM mySQL=20
installation.=20
<LI><TT>make</TT>=20
<LI><TT>make install</TT>=20
<LI>Create mysql config file: <TT>cp support-files/my-medium.cnf =
/opt/var/my.cnf</TT>=20
<LI>Create user/group <TT>mysql</TT>=20
<UL>
<LI>Test if user/group <TT>mysql</TT> already exists: =
<TT>groups=20
mysql</TT>=20
<LI>Create group: <TT>groupadd mysql</TT>=20
<LI>Create user: <TT>useradd -g mysql -M -r -d /opt/lib/mysql =
-s=20
/sbin/nologin -c "MySQL Server" mysql</TT> </LI></UL>
<LI><TT>chown -R mysql:mysql /opt/var/mysql</TT> =
</LI></UL>Configure:=20
<UL>
<LI>Install default database: =
<TT>/opt/mysql/bin/mysql_install_db=20
--user=3Dmysql</TT> <BR>Since this command is run as root, =
specify the=20
<TT>--user</TT> option to operate command as user =
<TT>mysql</TT>.=20
<BR>Creates help database with SQL script:=20
<TT>/opt/mysql/share/mysql/fill_help_tables.sql</TT>=20
<LI>Start mySQL database: <TT>/opt/mysql/bin/mysqld_safe =
--user=3Dmysql=20
&</TT>=20
<LI><TT>/opt/mysql/bin/mysqladmin -u root password=20
'<I>new-password</I>'</TT>=20
<LI><TT>/opt/mysql/bin/mysqladmin -u root -h yoserver2 password=20
'<I>new-password</I>'</TT>=20
<LI>See tutorial above for use and administration.=20
<LI>Check defaults: (Defaults from config file:=20
<TT>/opt/var/my.cnf</TT>)=20
<UL>
<LI><TT>/opt/mysql/bin/my_print_defaults --config-file=3Dmy =
client=20
mysql</TT>=20
<DL>
<DD>
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>--password=3D<I>supersecret</I>
--port=3D3306
--socket=3D/opt/tmp/mysql.sock
--no-auto-rehash
</PRE></TD></TR></TBODY></TABLE></DD></DL>
<LI><TT>/opt/mysql/bin/my_print_defaults --config-file=3Dmy =
client mysql=20
mysql_install_db</TT>=20
<DL>
<DD>
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>--datadir=3D/var/lib/mysql
--socket=3D/var/lib/mysql/mysql.sock
--password=3D<I>supersecret</I>
--port=3D3306
--socket=3D/opt/tmp/mysql.sock
--port=3D3306
--socket=3D/opt/tmp/mysql.sock
--skip-locking
--key_buffer=3D16M
--max_allowed_packet=3D1M
--table_cache=3D64
--sort_buffer_size=3D512K
--net_buffer_length=3D8K
--read_buffer_size=3D256K
--read_rnd_buffer_size=3D512K
--myisam_sort_buffer_size=3D8M
--log-bin
--server-id=3D1
</PRE></TD></TR></TBODY></TABLE></DD></DL></LI></UL></LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Commands/Man =
pages:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<DL>
<DD><SMALL>
<UL>
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Disamchk">isamchk=
</A>=20
- Check and repair of ISAM tables.=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Disamlog">isamlog=
</A>=20
- Write info about whats in a nisam log file.=20
<LI>msql2mysql=20
<LI>my_print_defaults=20
<LI>myisamchk=20
<LI>myisamlog=20
<LI>myisampack=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dmysql">mysql</A>=
=20
- text-based client for mysqld, a SQL-based relational =
database daemon=20
<LI>mysql_config=20
<LI>mysql_convert_table_format=20
<LI>mysql_find_rows=20
<LI>mysql_fix_privilege_tables=20
<LI>mysql_install_db=20
<LI>mysql_setpermission=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dmysql_zap">mysql=
_zap</A>=20
- a perl script used to kill processes=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dmysqlaccess">mys=
qlaccess</A>=20
- Create new users to mysql.=20
<LI>mysqlbinlog=20
<LI>mysqlbug=20
<LI>mysqlcheck=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dmysqld_multi">my=
sqld_multi</A>=20
- Used for managing several mysqld processes running in =
different UNIX=20
sockets and TCP/IP ports.=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dmysqldump">mysql=
dump</A>=20
- text-based client for dumping or backing up mysql databases =
, tables=20
and or data.=20
<LI>mysqldumpslow=20
<LI>mysqlhotcopy=20
<LI>mysqlimport=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dmysqlshow">mysql=
show</A>=20
- Shows the structure of a mysql database (databases,tables =
and=20
columns)=20
<LI>mysqltest=20
<LI>pack_isam=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dperror">perror</=
A>=20
- used to display a description for a system error code, or an =
MyISAM/ISAM table handler error code.=20
<LI><A=20
=
href=3D"http://www2.yo-linux.com/cgi-bin/man.cgi?topic=3Dreplace">replace=
</A>=20
- A utility program to replace changes strings in place in =
files or on=20
the standard input.=20
<LI>resolve_stack_dump=20
<LI>resolveip </LI></UL></SMALL></DD></DL>Server:=20
<DL>
<DD><SMALL>
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmysqladm=
in">mysqladmin</A>=20
- A utility for performing administrative operations=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dsafe_mys=
qld">safe_mysqld</A>=20
- The recommended way to start a mysqld daemon on Unix.=20
</LI></UL></SMALL></DD></DL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Admin GUI =
Tools:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<UL>
<LI><A =
href=3D"http://www.mysql.com/downloads/gui-mycc.html">MyCC</A>=20
<LI><A=20
=
href=3D"http://www.mysql.com/downloads/gui-mysqlgui.html">MySqlGUI</A>=20
<LI><A=20
=
href=3D"http://www.phpwizard.net/projects/phpMyAdmin/">phpMyAdmin</A> -=20
Web based </LI></UL>
<P>
<HR>
<P>If one would like to generate a GUI interface to the database, =
I would=20
recommenda web form to a Java servlet back-end or use a JAVA GUI =
program=20
and JDBC. See the <A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialTomcat.html#MYSQL">=
YoLinux=20
tutorial on accessing MySQL with JDBC in a Tomcat servlet =
example</A>.=20
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Links:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<UL>
<LI><A href=3D"http://www.mysql.com/">MySQL.com</A>:=20
<UL>
<LI><A =
href=3D"http://dev.mysql.com/doc/mysql/en/index.html">MySQL=20
reference manual</A>=20
<LI><A href=3D"http://dev.mysql.com/">MySQL developers =
manual</A>=20
</LI></UL>
<LI><A=20
=
href=3D"http://www.devshed.com/Server_Side/MySQL/Intro/page1.html">Devshe=
d.com:=20
MySQL Intro</A>=20
<LI><A =
href=3D"http://www.geekgirls.com/menu_databases.htm">GeekGirls.com:=20
Database basics</A> </LI></UL><A name=3DBOOKS></A>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD vAlign=3Dtop><IMG=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/book40.gif"><B><BIG>Books:=
</BIG></B></TD></TR></TBODY></TABLE>
<P>
<DL>
<DD>
<TABLE width=3D"100%" border=3D1 celpadding=3D"5">
<TBODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -