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)
-
2017年PHP错误总结范文
导语:如果你还是PHP新手的话,不妨就找些PHP错误点来看看。下面的是本站小编为大家搜集的2017年PHP错误总结,供大家参考。错误总结PHP-不断更新(新手必看)做开发请开启全部错误提示:error_reporting=E_ALL|E_STRICT屏蔽错误提示等于掩耳盗铃。代码写规范,错误少一半...
-
在PHP中使用随机数的三个步骤
如何做一个随机的出现的网页,可是用rand()就是不行,听说要初始化随机数,可是怎么初始化,请不吝赐教,谢谢!//第一步:初始化种子$seedarray=microtime();$seedstr=split("",$seedarray,5);$seed=$seedstr[0]*10000;//第二步:使用种子初始化随机数发生器srand($seed);//...
-
php中zend相对路径问题
php下使用zend相对路径的处理方法。如何使用呢?就跟随本站小编一起去了解下吧,想了解更多相关信息请持续关注我们应届毕业生考试网!<?phpdefine('P_S',PATH_SEPARATOR);define('ROOT',"../");set_include_path(ROOT.P_S.'Zend'.P_S_incl...
-
tp搜索时首页分页和搜索页保持条件分页的方法
在做搜索查询时突然发现在首页用的`分页代码在搜索页使用时出现错误,首页分页代码(代码中标注start与end部分为分页代码),下面是由本站小编为大家整理的Thinkphp搜索时首页分页和搜索页保持条件分页的方法,喜欢的可以收藏一下!了解更多详情资讯,请关注应届毕业生...