本帖最后由 tufei123 于 2016-5-13 16:46 编辑
[root@tufei init.d]# /usr/local/mysql/bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
就得到这样的提示 http://www.test.com/static/image/common/logo.png
[root@tufei init.d]# /usr/local/mysql/bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
就得到这样的提示 http://www.test.com/static/image/common/logo.png
0
# vi /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
改不了密码
在[mysqld]的段中加上一句:skip-grant-tables
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
改不了密码
0
[root@tufei ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
沧海一叶 发表于 2016-5-9 08:28
2.不使用任何参数直接mysql登录试试
[root@tufei ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
0
mysql> grant all on discuz.* to 'tufei'@'localhost' identified by 'tufeilinux';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
服务器运行带有--跳过授权表选项所以它不能执行此语句
做到这步就不行了
沧海一叶 发表于 2016-5-9 08:27
1.配置文件加上 skip-grant-tables 然后直接登录试试
mysql> grant all on discuz.* to 'tufei'@'localhost' identified by 'tufeilinux';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
服务器运行带有--跳过授权表选项所以它不能执行此语句
做到这步就不行了
0
[root@tufei ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@tufei ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
没设置密码
malong 发表于 2016-5-9 10:25
/usr/local/bin/mysql -uroot -p 试试
[root@tufei ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@tufei ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
没设置密码
0
你能进MYSQL命令行你就改掉ROOT的密码就可以了,你这样在授权用户 配置文件中都定义了跳过权限检查。
tufei123 发表于 2016-5-9 09:40
mysql> grant all on discuz.* to 'tufei'@'localhost' identified by 'tufeilinux';
ERROR 1290 (HY000 ...
你能进MYSQL命令行你就改掉ROOT的密码就可以了,你这样在授权用户 配置文件中都定义了跳过权限检查。
0
mysql 忘记root密码
参考文档
http://www.apelearn.com/bbs/fo ... 3D252
如果忘记root密码或其他用户密码,不要急,按下面操作即可。
1. 编辑mysql主配置文件 my.cnf
vim /etc/my.cnf
在[mysqld]字段下添加参数
skip-grant
2. 重启数据库服务
service mysqld restart
3. 这样就可以进入数据库不用授权了
mysql -uroot
4. 修改相应用户密码
use mysql;
update user set password=password('1234567890) where user='root';
flush privileges;
5. 修改/etc/my.cnf 去掉 skip-grant , 重启mysql服务
6. mysql -uroot -p
参考文档
http://www.apelearn.com/bbs/fo ... 3D252
如果忘记root密码或其他用户密码,不要急,按下面操作即可。
1. 编辑mysql主配置文件 my.cnf
vim /etc/my.cnf
在[mysqld]字段下添加参数
skip-grant
2. 重启数据库服务
service mysqld restart
3. 这样就可以进入数据库不用授权了
mysql -uroot
4. 修改相应用户密码
use mysql;
update user set password=password('1234567890) where user='root';
flush privileges;
5. 修改/etc/my.cnf 去掉 skip-grant , 重启mysql服务
6. mysql -uroot -p
0
mysql> update user set password=password('1234567890') where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
这个是修改成功了?
乐橙306 发表于 2016-5-9 11:18
mysql 忘记root密码
参考文档
mysql> update user set password=password('1234567890') where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
这个是修改成功了?
0
是的 按照步骤 继续操作
tufei123 发表于 2016-5-9 11:24
mysql> update user set password=password('1234567890') where user='root';
Query OK, 0 rows affe ...
是的 按照步骤 继续操作
0
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
方法三:
这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!!
# mysql -uroot -p
Enter password: <输入/etc/mysql/debian.cnf文件中[client]节提供的密码>
修改密码的多种方法:
方法1: 用SET PASSWORD命令
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
方法2:用mysqladmin
mysqladmin -u root password "newpass"
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass "newpass"
方法3: 用UPDATE直接编辑user表
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
方法三:
这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!!
# mysql -uroot -p
Enter password: <输入/etc/mysql/debian.cnf文件中[client]节提供的密码>
修改密码的多种方法:
方法1: 用SET PASSWORD命令
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
方法2:用mysqladmin
mysqladmin -u root password "newpass"
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass "newpass"
方法3: 用UPDATE直接编辑user表
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;
编辑回复