Mysql的安装和卸载
安装Mysql的方法
可以把Mysql安装在非系统盘,重装系统后只需重新注册一下Mysql服务即可.
> cd ../bin //进入Mysql路径下的bin目录中
> mysqld-nt -install //添加Mysql服务
卸载Mysql的方法
> cd ../bin //进入Mysql路径下的bin目录中
> mysqld-nt -remove //卸载Mysql服务
> //然后可以在Control Panel中 remove Mysql软件
忘记密码的解决办法(经测可用)
> net stop msyql //停止Mysql服务 | >killall -TERM mysqld //Linux下end mysql服务
>cd ../bin //进入Mysql路径下的bin目录中
>mysqld-nt --skip-grant-tables //让mysql服务跳过认证运行,保持这个窗口不关闭 |>bin/safe_mysqld --skip-grant-tables & //Linux下
>mysql -uroot //另打开一个shell,执行Mysql
>use mysql //切换数据库为mysql
>update user set password=password("new_pass") where user="root"; //更新用户密码
>flush privileges; //更新Mysql权限表
>exit //退出Mysql
>exit //关闭shell
//>然后在任务管理器里面end mysql-nt process
>mysql-nt //在第一次打开的shell中重新run mysql-nt process
//>然后就可以用新的密码登陆Mysql了
mysql有时候忘记密码了怎么办?(仅作为参考)
Windows下的实际操作如下
1.关闭正在运行的MySQL。
2.打开DOS窗口,转到mysql\bin目录。
3.输入mysqld-nt --skip-grant-tables回车。如果没有出现提示信息,那就对了。
4.再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysql\bin目录。??不需要转
5.输入mysql回车,如果成功,将出现MySQL提示符 >
6. 连接权限数据库>use mysql; (>是本来就有的提示符,别忘了最后的分号)
6.改密码:> update user set password=password("520") where user="root"; (别忘了最后的分号)
7.刷新权限(必须的步骤)>flush privileges;
8.退出 > \q
9.注销系统,再进入,开MySQL,使用用户名root和刚才设置的新密码123456登陆。
笔者按照"忘记密码的解决办法(经测可用)"做时的命令存档:
第一个DOS:
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>net stop mysql
没有启动 mysql 服务。
请键入 NET HELPMSG 3521 以获得更多的帮助。
C:\Users\Administrator>cd c:\appserv\mysql\bin
c:\AppServ\MySQL\bin> mysqld-nt --skip-grant-tables//如果不能执行在 mysqld-nt后面加一个.exe试试。
131121 20:50:40 [Warning] Changed limits: max_open_files: 2048 max_connections:
1910 table_cache: 64
第二个DOS:
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51b-community-nt-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> update user set password=("123456")where user="root";
Query OK, 3 rows affected (0.07 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> \q
Bye
c:\AppServ\MySQL\bin>