PHP數據庫:mysql重置密碼
認真掌握好每一個知識點,對容易混淆的`知識點更是要下大工夫搞清楚。以下是本站小編精心為大家整理的PHP語言編寫知識點之MySQL重置密碼,希望對大家有所幫助!更多內容請關注應屆畢業生網!
mysql重置密碼wulilideMacBook-Pro:bin wulili$ mysql start
ERROR 1045 (28000): Access denied for user 'wulili'@'locALhost' (using password: NO)
wulilideMacBook-Pro:bin wulili$ su - root
1、把mysql服務關閉 2、啟動mysqld_safe ,跳過啟動授權表。啟動時加上skip-grant-tables參數目的是在啟動mysql時不啟動grant-tables,授權表。這樣就可以修改root的密碼了。# mysqld_safe --skip-grant-tables &
wulilideMacBook-Pro:support-files root# find / -name mysqld_safe
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe
wulilideMacBook-Pro:support-files root# /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tables &
[1] 1397
wulilideMacBook-Pro:support-files root# 2016-11-30T11:47:40.6NZ mysqld_safe Logging to '/usr/local/mysql/data/'.
2016-11-30T11:47:40.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
mysql -uroot -p
Enter password: 按下回車鍵
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> update user set password=PASSWORD('12345678') where user="root";
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=PASSWORD('12345678') where user="root";
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> update user set passwd=PASSWORD('12345678') where user="root";
ERROR 1054 (42S22): Unknown column 'passwd' in 'field list'
mysql> update user set password=password('12345678') where User='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> update user set authentication_string=password('12345678') where user="root";
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
3、重啟數據庫wulilideMacBook-Pro:support-files root# /usr/local/mysql/support-files/er restart
Shutting down MySQL
..2016-11-30T11:58:22.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/ ended
SUCCESS!
Starting MySQL
. SUCCESS!
[1]+ Done /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tables
wulilideMacBook-Pro:support-files root# mysql -u root -p 這裏密碼就是12345678了
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> quit
Bye
wulilideMacBook-Pro:support-files root#
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by '12345678';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
-
PHP將XML轉為數組的方法
本文詳細介紹了,在php編程中,將XML數據轉換為數組的詳細過程,剖析了xml轉為php數組的具體方法,感興趣的朋友可以參考學習下。PHPXML轉數組首先,得到一個xml型的對象:複製代碼代碼示例:$resp=$this->c->execute($req,$sessionKey);//獲得xml對象$items=$resp->items;...
-
用PHP實現文件上傳二法
PHP(HypertextPreprocessor)是一種HTML內嵌式的語言(類似IIS上的ASP)。而PHP獨特的語法混合了C、Java、Perl以及PHP式的新語法。它可以比CGI或者Perl更快速的執行動態網頁。除此之外,用PHP寫出來的Web後端CGI程序,可以很輕易的移植到不同的系統平台上。我們在做...
-
PHP如何使用curl發送GET和POST請求
導語:PHP如何使用curl發送GET和POST請求,具體詳情請閲讀下面代碼,更多詳情請關注應屆畢業生考試網。使用CURL發送請求的基本流程使用CURL的PHP擴展完成一個HTTP請求的發送一般有以下幾個步驟:1.初始化連接句柄;2.設置CURL選項;3.執行並獲取結果;4.釋放VURL連接句柄。...
-
PHP常用開發技巧
PHP開發常用技巧能使你在開發過程中快而有效.以下就是小編精心推薦PHP常用開發技巧,希望對大家有幫助!1使用dowhile避免多層if語句嵌套我們直接舉例説明:實現方式①if($name=='hedong'){if($sex=='male'){if($major=='PHP'){$ret='...