从DOS切换到mysql:环境变量设置的问题

来源:互联网 发布:柏林工业大学 知乎 编辑:程序博客网 时间:2024/05/10 23:30

在WindowsXP中打开DOS,通过输入命令“mysql -u root -p”切换到mysql下,切换失败,如下所示:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:/>mysql -u root -p
'mysql' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
出现这种错误的原因是没有在环境变量PATH中将mysql的路径添加进去。如果是在unix平台,可以通过PATH=XXX;export PATH来进行路径的添加,在WindowsXP平台下,需要按照下面的方法来将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>
成功!

原创粉丝点击