一、问题描述

  1、在linux中已经安装好mysql,通过#ps -ef |grep mysql 能显示mysql已经启动,但去进入mysql命令页面出现如下问题:

   [root@root ~]# mysql u -p
-bash: mysql: command not found

  查找mysql是否已经启动

 [root@root ~]# ps -ef  | grep mysql
root 1172 1 0 18:28 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/service/mysql --pid-file=/service/mysql/root.pid
mysql 1285 1172 9 18:28 ? 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/service/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/service/mysql/root.err --pid-file=/service/mysql/root.pid
root 1440 1288 0 18:28 pts/1 00:00:00 grep mysql

  2、查找问题产生原因:

  原因:这是由于系统默认会查找/usr/bin下的命令,如果这个命令不在这个目录下,当然会找不到命令,我们需要做的就是映射一个链接到/usr/bin目录下,相当于建立一个链接文件。
首先得知道mysql命令或mysqladmin命令的完整路径,比如mysql的路径是:/usr/local/mysql/bin/mysql,【此路经是mysql实际安装路径】我们则可以这样执行命令  

 [root@root bin]# ln -fs /usr/local/mysql/bin/mysql /usr/bin/

  3、连接mysql  

 [root@root bin]# mysql -u -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.20 Source distribution Copyright (c) 2000, 2014, 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> Ctrl-C -- exit!
Aborted

#mysql:command not found的更多相关文章

  1. # mysql -u root -p -bash: mysql: command not found

    [root@jboss ~]# mysql -u root -p-bash: mysql: command not found 需要安装mysql # yum install mysql之后就行 了

  2. mysql 乱码问题(程序界面显示正常,mysql command line显示乱码)

    今天用java写一个程序,用的是mysql数据库.界面出现乱码,然后写了一个过滤器结果了乱码问题. 但是,当我在mysql command line 中查询数据的时候,在界面上显示正常的数据,在mys ...

  3. 解决bash: mysql: command not found 的方法

    root@DB-02 ~]# mysql -u root-bash: mysql: command not found 原因:这是由于系统默认会查找/usr/bin下的命令,如果这个命令不在这个目录下 ...

  4. -bash: mysql: command not found 解决办法 (转)

    root@DB-02 ~]# mysql -u root-bash: mysql: command not found 原因:这是由于系统默认会查找/usr/bin下的命令,如果这个命令不在这个目录下 ...

  5. Mysql安装后打开MySQL Command Line Client闪退解决方法

    1.开始菜单下;Mysql--->mysql server 5.6-->mysql command line Client ---右击,选择属性 2.在属性下查看目标位置: 3.将安装目录 ...

  6. (转)mysql command line client打不开(闪一下消失)的解决办法

    转自:http://www.2cto.com/database/201209/153858.html 网上搜索到的解决办法: 1.找到mysql安装目录下的bin目录路径. 2.打开cmd,进入到bi ...

  7. 解决linux mysql命令 bash: mysql: command not found 的方法

    错误: root@DB-02 ~]# mysql -u root-bash: mysql: command not found 原因:这是由于系统默认会查找/usr/bin下的命令,如果这个命令不在这 ...

  8. MySQL问题解决:-bash:mysql:command not found

      问题:        [root@linux115 /]# mysql -uroot -p          -bash: mysql: command not found    www.2cto ...

  9. Linux 下 -bash: mysql: command not found解决办法

    -bash: mysql: command not found 1.vim ~/.bash_profile 最下面写 export PATH=$PATH:/usr/local/mysql/bin(你的 ...

随机推荐

  1. 安装mongodb 远程服务器报错

    安装的时候百度了各种教程 就是装不上 结果原因看下图吧  后面这神秘代码是什么鬼 加上后就能正常下载了

  2. HDU 4920 居然会超时

    题意:求两个n*n的矩阵相乘的结果,得出的每个元素%3: 分析:2000ms然后n的范围是800,我们自己估算的时间复杂度并不会超时,但是结果就是超时了. #include <cstdio> ...

  3. Python 基础之在ubuntu系统下安装双版本python

    前言:随着python升级更新,新版本较于老版本功能点也有不同地方,作为一个初学者应该了解旧版本的规则,也要继续学习新版本的知识.为了能更好去学习python,我在ubuntu安装python2和py ...

  4. 项目用到的icarouls类和UIEffectDesignerView类,菜单技巧,构思(金方圆)

    // //  MenuHomeViewController.m //  HFYS // //  Created by Showsoft_002 on 13-8-14. //  Copyright (c ...

  5. debain 8为Iceweasel安装flash播放器

    到adobe官网下载flash.或https://get.adobe.com/flashplayer/?loc=cn 下载tar.gz文件后,解压缩后会有一个libflashplayer.so 文件. ...

  6. iOS中的extern与static

    1.extern #import <Foundation/Foundation.h> extern NSString *DBDefaultName; @interface DataBase ...

  7. parentNode、parentElement,childNodes、children 它们有什么区别呢?

    parentNode.parentElement,childNodes.children 它们有什么区别呢?parentElement 获取对象层次中的父对象. parentNode 获取文档层次中的 ...

  8. SQL server2008-对象资源管理器-数据库

    数据库:系统数据库(master.model.msdb.tempdb).数据库快照.自定义数据库组成 三部分组成. master:Master数据库是SQL Server中最重要的系统数据库,记录了S ...

  9. iOS中常用的设计模式

    常用的设计模式(一)代理模式应用场景:当一个类的某些功能需要由别的类来实现,但是又不确定具体会是哪个类实现.优势:解耦合敏捷原则:开放-封闭原则实例:tableview的 数据源delegate,通过 ...

  10. 我的第一个GitHub仓库

    GitHub 仓库地址 https://github.com/FBean/test.git GitHub 常用命令 add--Add file contents to the index bisect ...