你用root登录后,可以用如下语句进行修改:
mysql>use mysql;
mysql>update user set password=password("123456") where host="localhost" and user="root";如果要对别人进行授权就要用grant语句
我举个例子给你参考一下:
mysql>grant select,delete,insert,update,create,drop,index on inventory.* to david@localhost with grant option;上例中 on前面的都是privileges, 即是他可以进行的操作;
后面的inventory是数据库名,inventory.*表示数据库里的所有表
to参数后david是用户名,localhost是主机,可以用IP地址,后面还可以有一个identified by选项
用来添加密码.
identified by "123456"
mysql>use mysql;
mysql>update user set password=password("123456") where host="localhost" and user="root";如果要对别人进行授权就要用grant语句
我举个例子给你参考一下:
mysql>grant select,delete,insert,update,create,drop,index on inventory.* to david@localhost with grant option;上例中 on前面的都是privileges, 即是他可以进行的操作;
后面的inventory是数据库名,inventory.*表示数据库里的所有表
to参数后david是用户名,localhost是主机,可以用IP地址,后面还可以有一个identified by选项
用来添加密码.
identified by "123456"
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'我查了一下当前sever信息是:
Connection id: 8
Current database:
Current user: ODBC@localhost
SSL: Not in use
Server version: 4.0.20a-nt
Protocol version: 10
Connection: localhost via TCP/IP
Client characterset: latin1
Server characterset: gbk
TCP port: 3306
Uptime: 20 min 40 sec可是我不知道如何来改变用户啊
你在dos的命令提示符下用以下方式进入mysql就可以了:
C:\Documents and Settings\Administrator>mysql -uroot -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23 to server version: 4.1.12-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.说明:因为mysql的bin目录已经写到环境变量中去了,所以可以这样登录。
又因为你的是空密码,所以你可以用mysql -uroot 就可以了,
如果你看到
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23 to server version: 4.1.12-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.
就说明你已经正常登录,然后你再用我上面所说方法试试。
(C) 版权所有 1985-2000 Microsoft Corp.C:\Documents and Settings\Administrator>mysql -uroot -p
Enter password: **
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)C:\Documents and Settings\Administrator>mysql -uroot -p
Enter password: ****************
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)C:\Documents and Settings\Administrator>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28 to server version: 4.0.20a-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>第一次:我用00登录不行,第二次:我用的是我从mysql管理软件中直接复制修改后的password字段中的内容;第三次:我用的是空密码,真是晕了,明明改了为什么不行呢?我早上的时候直接在管理软件里改成00保存后,也是不行,还是空密码,请问楼上的是什么原因啊?实在不好意思,我一问再问^_^!