#mysql:command not found

來源:互聯網
上載者:User

標籤:man   bash   err   rac   base   產生   nbsp   mysql   type   

一、問題描述

  1、在linux中已經安裝好mysql,通過#ps -ef |grep mysql 能顯示mysql已經啟動,但去進入mysql命令頁面出現如下問題:

1   [[email protected] ~]# mysql u -p2 -bash: mysql: command not found

   尋找mysql是否已經啟動

1 [[email protected] ~]# ps -ef  | grep mysql2 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.pid3 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.pid4 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實際安裝路徑】我們則可以這樣執行命令  

1 [[email protected] bin]# ln -fs /usr/local/mysql/bin/mysql /usr/bin/
  3、串連mysql  
 1 [[email protected] bin]# mysql -u -p 2 Welcome to the MySQL monitor.  Commands end with ; or \g. 3 Your MySQL connection id is 1 4 Server version: 5.6.20 Source distribution 5  6 Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 7  8 Oracle is a registered trademark of Oracle Corporation and/or its 9 affiliates. Other names may be trademarks of their respective10 owners.11 12 Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.13 14 mysql> Ctrl-C -- exit!15 Aborted



#mysql:command not found

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.