baiting0317

linux下mysql 的简单使用

目前安装mysql版本:mysql 5.1.69(最新版本5.6)

CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法  

2012-12-01 17:29:40|  分类: linux |  标签:centos  mysql登陆报错  linux登陆mysql  error  1045  |字号 订阅

 
 

 

1、停用mysql服务:# /etc/rc.d/init.d/mysqld stop

2、输入命令:# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

3、登入数据库:# mysql -u root mysql

4mysql> use mysql; 结果如下:

   Database changed

5mysql> UPDATE user SET Password=PASSWORD(\'newpassword\')where USER=\'newuser\';

结果如下:

Query OK, 3 rows affected (0.00 sec)

Rows matched: 3  Changed: 3  Warnings: 0

 

mysql> FLUSH PRIVILEGES;

结果如下:

Query OK, 0 rows affected (0.00 sec)

mysql> quit

# /etc/init.d/mysql restart

# mysql -u newuser –p

Enter password: newpassword

mysql><登录成功>

 

分类:

技术点:

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2021-11-30
  • 2022-02-18
  • 2021-09-23
  • 2022-02-01
  • 2022-12-23
猜你喜欢
  • 2021-09-10
  • 2021-11-20
  • 2021-10-06
  • 2021-05-20
  • 2021-07-05
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案