原因:没有在环境变量PATH中将mysql的路径添加进去。
解决方法:1、win+r–>services.msc–>右击mysql服务–>属性–>找到可执行路径并复制出来
2、右击“我的电脑”–>属性–>高级系统设置–>环境变量–>系统变量–>PATH–>新增–>上面的“可执行路径”
定位到你的 MYSQL安装目录之后再找到bin目录, 如: C:\Program Files\MySQL\MySQL Server 5.5\bin
添加完毕之后,以管理员的身份启动dos,再到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>
出现了mysql>就表示成功了!