安装mysql4.0后密码的设定方法
- 格式:doc
- 大小:1.93 MB
- 文档页数:3
安装mysql4.0后密码设定方法
在windows下:
1. 打开命令行窗口,停止mysql服务:Net stop mysql
2. 到mysql的安装路径启动mysql,在bin目录下使用mysqld-nt.exe启动,在命令行窗口执行:mysqld-nt --skip-grant-tables,然后终止mysqld-nt进程
3. 开启服务用net start mysql
4. 另外打开一个命入令行窗口(自己验证可以不另开窗口),执行mysql,此时无需输入密码即可进入。
>use mysql
>update user set password=password("new_pass") where user="root";
(或者set password for root=PASSWORD(“813”);)
>flush privileges;
>exit
使用任务管理器,找到mysqld-nt的进程,结束进程!
在重新启动mysql-nt服务,就可以用新密码登录了。
Mysqlgui中输入密码后如果仍然进不去则输入则需检查设置:
Host name 应该为localhost 注意:localhost=127.0.0.1
允许其他主机访问则要先赋予权限
权限赋予方法:
1 用mysqlgui:
在commands-->Administration-->Grant/Revoke下赋予权限:
设置用户密码:
在commands-->Administration-->SetPassword下选择用户进行设置。
2 DOS命令:
在mysql\bin下进入mysql后用以下命令:
grant all privileges on *.* to 创建的用户名@"%" identified by "密码";
grant all privileges on *.* to root @"202.117.37.172" identified by "813116"; grant all privileges on *.* to 'root'@'202.117.37.172' identified by '813116'; grant all privileges on *.* to 'root'@'202.117.37.209' identified by '813116' with grant option;
用下面命令可以显示某一数据库下的所有用户及密码
use mysql; select host,user,password from user;
该用户名:
update db set host = '%' where user = 'root';
A: 原因是mysql考虑到安全因素,默认配置只让从本地登录
在my.ini 文件,找到bind-address = 127.0.0.1 修改为bind-address = 0.0.0.0。