mysql环境变量设置

环境变量我都经常用到,在WindowsXP中打开DOS,通过输入命令“mysql -u root -p”切换到mysql下,切换失败,如下所示

在运行里输入cmd后启动doc窗口 ,然后输入如下指令mysql -u root -h127.0.0.1 -p
报错:
'mysql' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

原因:

出现这种错误的原因是没有在mysql环境变量PATH中将mysql的路径添加进去。

解决方法:

在Windows平台下,需要按照下面的方法来将mysql路径添加到mysql环境变量中:

右键点击“我的电脑”-“属性”-“高级”-“环境变量”-“系统变量”-双击“Path”-将mysql的路径“C:\Program Files\MySQL\MySQL Server 5.0\bin”添加进去-“确定”

添加完毕之后,再到DOS下进行测试:

C:\>mysql -u root -p
Enter password: **********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

成功!

 

posted @ 2013-11-22 12:12  qmsu  阅读(661)  评论(0编辑  收藏  举报