ÖØÐÂÕÒµ½MySQLÊý¾Ý¿âµÄrootÃÜÂë
Unix&Linux£º
1.ÓÃroot»òÕßÔËÐÐmysqldµÄÓû§µÇ¼ϵͳ£»
2£®ÀûÓÃkillÃüÁî½áÊøµômysqldµÄ½ø³Ì£»
3£®Ê¹ÓÃ--skip-grant-tables²ÎÊýÆô¶¯MySQL Server
shell>mysqld_safe --skip-grant-tables &
4.Ϊroot@localhostÉèÖÃÐÂÃÜÂë
shell>mysqladmin -u root flush-privileges password "newpassword"5£®ÖØÆôMySQL Server
µ«×ܵÃ×Ô¼ºÊµ¼ùһϣ¬·½·¨ÈçÏ£º
1.¹Ø±Õmysql·þÎñ
/etc/init.d/mysqld stop
2.ʹÓÖskip-grant-tablesÑ¡ÏîÆô¶¯MySQL·þÎñ,¿ÉÒÔÐÞ¸Ä/etc/inin.d/mysqld½Å±¾Æô¶¯Î»ÖÃÔö¼Ó´ËÑ¡Ï
vi /etc/init.d/mysqld
ÔÚÏÂÃæÔËÐÐÆô¶¯µÄÓï¾äÀïÔö¼Ó--skip-grant-tables
/usr/bin/mysqld_safe --skip-grant-tables --datadir="$datadir" --socket="$socketfile" \
--log-error="$errlogfile" --pid-file="$mypidfile" \
¼ÓÈë--skip-grant-tablesµÄÒâ˼ÊÇÆô¶¯MySQL·þÎñµÄʱºòÌø¹ýȨÏÞ±íÈÏÖ¤¡£Æô¶¯ºó£¬Á¬½Óµ½MySQLµÄroot²»ÐèÒª¿ÚÁî
3.ÖØÐÂÆô¶¯mysql·þÎñ
/etc/init.d/mysqld start
4.ÐÞ¸ÄrootÓû§µÄÃÜÂ룻
mysql> update mysql.user set password=PASSWORD£¨'123456'£© where User=root£»
mysql> flush privileges£»
mysql> quit
5. ÖØÐÂÆô¶¯MySQL£¬¾Í¿ÉÒÔʹÓÃÐÂÃÜÂëµÇ¼ÁË¡£
mysql -u root –p
ÊäÈëÃÜÂ룺123456
6.¹Ø±Õmysql·þÎñ
/etc/init.d/mysqld stop
7.ÖØÐÂÐ޸ĵÚ2²½Ð޸ĵÄ/etc/init.d/mysqld£¬Ê¹Æä±£³ÖÔÀ´²»±ä£¬Ò²¾ÍÊÇÈ¡Ïû--skip-grant-tablesÓï¾ä8.ÖØÐÂÆô¶¯mysql·þÎñ
/etc/init.d/mysqld start
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/cndes/archive/2009/11/05/4770378.aspx
Ïà¹ØÎĵµ£º
Ê×ÏÈÍ£Ö¹MySQL·þÎñ£ºsudo /etc/init.d/mysql stop
È»ºó±à¼MySQLÅäÖÃÎļþ£ºsudo gedit /etc/mysql/my.cnf
ÔÚmy.cnfÎļþÖеÄ[client]¶ÎÏÂÃæ¼ÓÈë
default-character-set=utf8
[mysqld_safe]
default-character-set=utf8
[mysqld]
default-character-set=utf8
[mysql]
default-character-set=utf8
ÖØÐÂÆô¶¯MySQL·þÎñ ......
<?php
/**
* Mysql DB
*
* @author Administrator
* @package defaultPackage
*/
class MySqlDB{
private $_db;
private static $_instance;
private function __construct(&$db_type){
global $connectionstr;
$conn_db=$connectionstr[$db_type];
$this->_db=mysql_pconnect($conn ......
L1¡¢HTML¾²Ì¬»¯
Æäʵ´ó¼Ò¶¼ÖªµÀ£¬Ð§ÂÊ×î¸ß¡¢ÏûºÄ×îСµÄ¾ÍÊÇ´¿¾²Ì¬»¯µÄhtmlÒ³Ãæ£¬ËùÒÔÎÒÃǾ¡¿ÉÄÜʹÎÒÃǵÄÍøÕ¾ÉϵÄÒ³Ãæ²É Óþ²Ì¬Ò³ÃæÀ´ÊµÏÖ£¬Õâ¸ö×î¼òµ¥µÄ·½·¨ÆäʵҲÊÇ×îÓÐЧµÄ·½·¨¡£µ«ÊǶÔÓÚ´óÁ¿ÄÚÈݲ¢ÇÒÆµ·±¸üеÄÍøÕ¾£¬ÎÒÃÇÎÞ·¨È«²¿ÊÖ¶¯È¥°¤¸öʵÏÖ£¬ÓÚÊdzöÏÖÁËÎÒÃdz£¼ûµÄÐÅÏ¢ ·¢²¼ÏµÍ³CMS£¬ÏñÎÒÃdz£·ÃÎʵĸ÷¸öÃÅ»§Õ¾µãµÄÐ ......
linux:
Èç¹û MySQL ÕýÔÚÔËÐУ¬Ê×ÏÈɱ֮£º killall -TERM mysqld¡£
Æô¶¯ MySQL £º/usr/bin/safe_mysqld --skip-grant-tables &
¾Í¿ÉÒÔ²»ÐèÒªÃÜÂë¾Í½øÈë MySQL ÁË¡£
È»ºó¾ÍÊÇ
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
ÖØÐÂɱ MySQL £¬ ......