mysql问题处理(报错代码 -bash:mysql:command not found)


问题为:

[root@Neo777 bin]# mysql -u root -p

-bash: mysql: command not found       #报错


原因:这是由于系统默认会查找(默认在/usr/bin下)的命令,如果这个命令不在这个目录下,当然会找不到命令,

我们需要做的就是映射一个链接到/usr/bin目录下,相当于建立一个链接文件。首先得知道mysql命令或mysqladmin命令的完整路径,比如mysql的路径

是:/www/lanmps/mysql5.7.17/bin/mysql,我们则可以如下这样执行命令:

root@Neo777 bin]# ln -s /www/lanmps/mysql5.7.17/bin/mysql /usr/bin
[root@Neo777 bin]# mysql -u root -p


Enter password:                                                                                                            #(默认为空密码)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 Source distribution


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql>                                                                                                                        #(进入mysql)

猜你喜欢

转载自blog.csdn.net/qq_33468857/article/details/73826191