??xml version="1.0" encoding="utf-8" standalone="yes"?>色一区二区三区,国产精品国产,久久一区二区三区超碰国产精品http://www.aygfsteel.com/libin2722/category/40888.html虚其?j),可解天下之问Q专其心(j)Q可d下之学;?rn)其心(j),可(zhn)天下之理Q恒其心(j)Q可成天下之业?/description>zh-cnFri, 18 Sep 2015 21:04:01 GMTFri, 18 Sep 2015 21:04:01 GMT60MySQL导入.sql文g?qing)常用命?/title><link>http://www.aygfsteel.com/libin2722/articles/427346.html</link><dc:creator>C物</dc:creator><author>C物</author><pubDate>Wed, 16 Sep 2015 00:49:00 GMT</pubDate><guid>http://www.aygfsteel.com/libin2722/articles/427346.html</guid><wfw:comment>http://www.aygfsteel.com/libin2722/comments/427346.html</wfw:comment><comments>http://www.aygfsteel.com/libin2722/articles/427346.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/libin2722/comments/commentRss/427346.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/libin2722/services/trackbacks/427346.html</trackback:ping><description><![CDATA[ <p style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: left; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-indent: 2em; background-color: rgb(255, 255, 255);"> <strong> <em> <span style="font-size: large;"> <span style="color: rgb(255, 0, 0);">MySQL导入.sql文g?qing)常用命?/span> </span> </em> </strong> </p> <table style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" border="0"> <tbody> <tr> <td> <p style="margin: 0px; padding: 0px;"> <span style="color: rgb(0, 0, 0);"> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">在MySQL Qurey   Brower中直接导?.sql脚本Q是不能一ơ执行多条sql命o(h)的,在mysql中执行sql文g的命令:(x)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysql> source   d:/myprogram/database/db.sql;</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">另附mysql常用命o(h)Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">一) q接MYSQLQ?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    格式Q?mysql -hL地址 -u用户?Qp用户密码</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">1、例1Q连接到本机上的MYSQL</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    首先在打开DOSH口Q然后进入mysql安装目录下的bin目录下,例如Q?D:/mysql/binQ再键入命o(h)mysql -uroot -pQ回车后提示你输密码Q如果刚安装好MYSQLQ超U用户root是没有密码的Q故直接回R卛_q入到MYSQL中了(jin)QMYSQL的提C符是:(x)mysql></span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">2、例2Q连接到q程L上的MYSQL (q程QIP地址)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    假设q程L的IP为:(x)10.0.0.1Q用户名为root,密码?23。则键入以下命o(h)Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">   mysql -h10.0.0.1 -uroot -p123</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">   Q注Qu与root可以不用加空|其它也一P(j)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">3、退出MYSQL命o(h)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    exit Q回车)(j)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">(? 修改密码Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    格式Qmysqladmin -u用户?-p旧密?password 新密?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">1、例1Q给root加个密码123。首先在DOS下进入目录C:/mysql/binQ然后键入以下命令:(x)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    mysqladmin -uroot -password 123</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    注:(x)因ؓ(f)开始时root没有密码Q所?p旧密码一就可以省略?jin)?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">2、例2Q再root的密码改?56</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    mysqladmin -uroot -pab12 password 456</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">(? 增加新用P(x)Q注意:(x)和上面不同,下面的因为是MYSQL环境中的命o(h)Q所以后面都带一个分号作为命令结束符Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    格式Qgrant select on 数据?* to 用户名@dL identified by "密码"</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    ?、增加一个用户test1密码为abcQ让他可以在ML上登录,q对所有数据库有查询、插入、修攏V删除的权限。首先用以root用户q入MYSQLQ然后键入以下命令:(x)     grant select,insert,update,delete on *.* to<span id="wmqeeuq" class="Apple-converted-space"> </span></span> </span> <a href="mailto:test2@localhost" style="color: rgb(202, 0, 0); text-decoration: none;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">test2@localhost</span> </span> </a> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);"> <span id="wmqeeuq" class="Apple-converted-space"> </span>identified by "abc";</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    如果你不想test2有密码,可以再打一个命令将密码消掉。   ?grant select,insert,update,delete on mydb.* to<span id="wmqeeuq" class="Apple-converted-space"> </span></span> </span> <a href="mailto:test2@localhost" style="color: rgb(202, 0, 0); text-decoration: none;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">test2@localhost</span> </span> </a> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);"> <span id="wmqeeuq" class="Apple-converted-space"> </span>identified by "";</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">(? 昄命o(h)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">1、显C数据库列表Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    show databases;     刚开始时才两个数据库Qmysql和test。mysql库很重要它里面有MYSQL的系l信息,我们改密码和新增用户Q实际上是用这个库q行操作?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">2、显C库中的数据表:(x)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    use mysqlQ?//打开库  ?show tables;</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">3、显C数据表的结构:(x)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    describe 表名;</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">4、徏库:(x)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    create database 库名;</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">5、徏表:(x)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    use 库名Q   ?create table 表名 (字段讑֮列表)Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">6、删库和删表:</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    drop database 库名;     drop table 表名Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">7、将表中记录清空Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    delete from 表名;</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">8、显C中的记录Q?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">    select * from 表名;</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">导出sql脚本</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u 用户?-p 数据库名 > 存放位置</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u root -p test > c:/a.sql</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">导入sql脚本</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysql -u 用户?-p 数据库名 < 存放位置</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqljump -u root -p test < c:/a.sql</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">注意,test数据库必dl存?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">MySQL导出导入命o(h)的用?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">1.导出整个数据?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u 用户?-p 数据库名 > 导出的文件名</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">2.导出一个表</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u 用户?-p 数据库名表名> 导出的文件名</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">3.导出一个数据库l构</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:wcnc_db.sql</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">-d 没有数据 --add-drop-table 在每个create语句之前增加一个drop table</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">4.导入数据?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 255);"> <span style="color: rgb(0, 0, 0);"> </span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">常用source 命o(h)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">q入mysql数据库控制台,</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">如mysql -u root -p</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysql>use 数据?/span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">然后使用source命o(h),后面参数本文?如这里用到的.sql)</span> </span> </p> <p style="margin: 0px; padding: 0px; text-indent: 2em;"> <span style="color: rgb(0, 0, 0);"> <span style="background-color: rgb(255, 255, 255);">mysql>source d:wcnc_db.sql</span> </span> </p> </td> </tr> </tbody> </table> <img src ="http://www.aygfsteel.com/libin2722/aggbug/427346.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/libin2722/" target="_blank">C物</a> 2015-09-16 08:49 <a href="http://www.aygfsteel.com/libin2722/articles/427346.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ERROR 2006 (HY000) at line xx: MySQL server has gone away 解决Ҏ(gu) http://www.aygfsteel.com/libin2722/articles/427345.htmlC物C物Wed, 16 Sep 2015 00:48:00 GMThttp://www.aygfsteel.com/libin2722/articles/427345.htmlhttp://www.aygfsteel.com/libin2722/comments/427345.htmlhttp://www.aygfsteel.com/libin2722/articles/427345.html#Feedback0http://www.aygfsteel.com/libin2722/comments/commentRss/427345.htmlhttp://www.aygfsteel.com/libin2722/services/trackbacks/427345.html1.执行扚w的MYSQL语句Q例如备份恢复的时候,旉q长?
对应Q修改my.cnf中的wait_timeout和interactive_timeout变量
在一些不便修改的情Ş下,如租用的I间Q可以采取sql语句修改Q如何做呢?

解决办法

扑ֈmy.ini文g

d一句max_allowed_packet=16MQ如果不行将16M再加?/p>

加大wait_timeout也可起一定作?/p>

eg:

wait_timeout=2880000
interactive_timeout = 2880000
max_allowed_packet = 100M

应用时记住重启数据库哦~?/strong>

除此之外Q可能还有一些别的buffer_size的变量会(x)影响刎ͼ也值得注意
例如
read_buffer_size
read_rnd_buffer_size


C物 2015-09-16 08:48 发表评论
]]>
iBatis 新增时候主键的获取(MySql)http://www.aygfsteel.com/libin2722/articles/297835.htmlC物C物Mon, 12 Oct 2009 00:45:00 GMThttp://www.aygfsteel.com/libin2722/articles/297835.htmlhttp://www.aygfsteel.com/libin2722/comments/297835.htmlhttp://www.aygfsteel.com/libin2722/articles/297835.html#Feedback0http://www.aygfsteel.com/libin2722/comments/commentRss/297835.htmlhttp://www.aygfsteel.com/libin2722/services/trackbacks/297835.html        insert into usersrcaccount
        (
            USER_ID,
            SOURCETYPE,
            ACCOUNT,
            PASSWORD
        )
        values
        (
            #userId#,
            #sourceType#,
            #account#,
            #password#
        )
        <selectKey resultClass="java.lang.Long" keyProperty="id" >
            SELECT @@IDENTITY AS id
        </selectKey>
    </insert>

C物 2009-10-12 08:45 发表评论
]]>
如何开启MySQL的远E帐?http://www.aygfsteel.com/libin2722/articles/287099.htmlC物C物Fri, 17 Jul 2009 02:41:00 GMThttp://www.aygfsteel.com/libin2722/articles/287099.htmlhttp://www.aygfsteel.com/libin2722/comments/287099.htmlhttp://www.aygfsteel.com/libin2722/articles/287099.html#Feedback0http://www.aygfsteel.com/libin2722/comments/commentRss/287099.htmlhttp://www.aygfsteel.com/libin2722/services/trackbacks/287099.html开?MySQL 的远E登陆帐h两大步:(x)

1、确定服务器上的防火墙没有阻?3306 端口?/p>

MySQL 默认的端口是 3306 Q需要确定防火墙没有L 3306 端口Q否则远E是无法通过 3306 端口q接?MySQL 的?/p>

如果(zhn)在安装 MySQL 时指定了(jin)其他端口Q请在防火墙中开启?zhn)指定?MySQL 使用的端口号?/p>

如果不知道怎样讄(zhn)的服务器上的防火墙Q请向?zhn)的服务器理员咨询?/p>

2、增加允许远E连?MySQL 用户q授权?/p>

1Q首先以 root 帐户登陆 MySQL

?Windows L中点d始菜单,q行Q输入“cmd”,q入控制収ͼMySQL ?bin 目录下,然后输入下面的命令?/p>

?Linux L中在命o(h)提示行下输入下面的命令?/p>

> MySQL -uroot -p123456

123456 ?root 用户的密码?/p>

2Q创E登陆用户ƈ授权

> grant all PRIVILEGES on discuz.* to ted@'123.123.123.123' identified by '123456';

上面的语句表C将 discuz 数据库的所有权限授权给 ted q个用户Q允?ted 用户?123.123.123.123 q个 IP q行q程登陆Qƈ讄 ted 用户的密码ؓ(f) 123456 ?/p>

下面逐一分析所有的参数Q?/p>

all PRIVILEGES 表示赋予所有的权限l指定用Pq里也可以替换ؓ(f)赋予某一具体的权限,例如Qselect,insert,update,delete,create,drop {,具体权限间用?”半角逗号分隔?/p>

discuz.* 表示上面的权限是针对于哪个表的,discuz 指的是数据库Q后面的 * 表示对于所有的表,由此可以推理出:(x)对于全部数据库的全部表授权ؓ(f)?.*”,对于某一数据库的全部表授权ؓ(f)“数据库?*”,对于某一数据库的某一表授 权ؓ(f)“数据库?表名”?/p>

ted 表示你要l哪个用h权,q个用户可以是存在的用户Q也可以是不存在的用戗?/p>

123.123.123.123 表示允许q程q接?IP 地址Q如果想不限刉接的 IP 则设|ؓ(f)?”即可?/p>

123456 为用L(fng)密码?/p>

执行?jin)上面的语句后,再执行下面的语句Q方可立即生效?/p>

> flush privileges;


C物 2009-07-17 10:41 发表评论
]]>
վ֩ģ壺 ̨| Ƹ| | | ٲ| | ³| ʡ| ʲ| | ǿ| | Т| | | | | | | | ־| | ʡ| | | | | | | ԭ| Ϫ| γ| ϳ| Ϫ| ԫ| | ī񹤿| | | | ӳ|