MySQL5.5数据库设置root密码_笔记本数据恢复1
日期:2014-07-13 / 人气: / 来源:网络
设置成功后再启动MySQL服务:
net start mysql
启动后:
c:mysql5.5binmysql -u root -p
回车后会要求输入密码,这里密码为空,所以直接回车
回车后,如果命令行显示"mysql>",表示登录成功
输入下列命令修改root密码:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('新密码');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('新密码');
SET PASSWORD FOR 'root'@'::1' = PASSWORD('新密码');
SET PASSWORD FOR 'root'@'%' = PASSWORD('新密码');
新手在这个上往往容易范错误,导致不能进入MYSQL,整得非常郁闷。
我来做几个例子相信很快就明白了 。
1、原来的密码是123456
C:>type mysql5.bat
@echo off
mysql -uroot -p123456 -P3306
正确的修改MYSQL用户密码的格式是:
我们这里用
用户:root(可以换成其他的)
密码:woshiduide
来演示新密码。
C:>mysqladmin -uroot -p password woshiduide
Enter password: ******
于是修改成功。
注意PASSWORD关键字后面的空格
有好多人是这样修改的:
C:>mysqladmin -uroot -p password 'woshiduide'
Enter password: ******
C:>mysqladmin -uroot -p password 'woshiduide'
Enter password: *********
Warning: single quotes were not trimmed from the password by your command
line client, as you might have expected.
而这个时候真正的密码是'woshiduide'
C:>mysql -uroot -p'woshiduide'
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 18
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
而新手往往这样:
C:>mysql -uroot -pwoshiduide
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
所以非常郁闷,BAIDU、GOOGLE的搜了一大堆。
我现在把密码改回去。
C:>mysqladmin -uroot -p'woshiduide' password 123456
2、还有就是可以直接进入MYSQL,然后修改密码。
mysql> use mysql
Database changed
mysql> update user set PASSWORD = PASSWORD('woshiduide') where USER='root' and H
OST='localhost';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
mysql> exit
Bye
C:>mysql -uroot -pwoshiduide
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 23
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
Query OK, 0 rows affected (0.02 sec)
3、还有一种就是用SET PASSWORD 命令修改:
C:>mysql5.bat
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 8
Server version: 5.1.17-beta-community-nt-debug-log MySQL Community Server (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> set password for root@'localhost' = password('woshiduide');
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.09 sec)
mysql> exit
Bye
Linux系统中MySQL数据库的文件路径
导读:特别值得一提的是Linux MySQL有很多值得学习的地方,这里我们主要介绍Linux MySQL,包括介绍LinuxMySQL各种等方面。Linux MySQL安装完成后不象SQLServer默认安装在一个目录,它的数据库文件、配置文件和命令文件分别在不同的
MySQL安装,
作者:管理员
推荐内容 Recommended
- 江苏飞浩信息科技期待您的加入07-20
- 江苏飞浩科技欢迎您07-19
相关内容 Related
- 江苏飞浩信息科技期待您的加入07-20
- 江苏飞浩科技欢迎您07-19