First, the problem description
1, Linux has been installed in MySQL, through the #ps-ef |grep MySQL can show that MySQL has been started, but to go to the MySQL command page, the following problems appear:
1 [[email protected] ~] - P 2 - not found
Find out if MySQL is already started
1 [[email protected] ~]# PS-Ef|grep MySQL2Root1172 1 0 -: -?xx:xx:xx /Bin/Sh/Usr/Local/Mysql/Bin/Mysqld_safe--Datadir=/service/mysql--pid-file=/service/mysql/root.pid3Mysql1285 1172 9 -: -?xx:xx: on /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.pid4Root1440 1288 0 -: -Pts/1 xx:xx:xxgrep MySQL
2, find the cause of the problem:
Cause: This is because the system will find the command under/usr/bin by default, if this command is not in this directory, of course, will not find the command, we need to do is to map a link to the/usr/bin directory, equivalent to create a link file.
First you need to know the full path of the MySQL command or mysqladmin command, such as the path to MySQL is:/usr/local/mysql/bin/mysql, "This path is the actual MySQL installation path" We can execute the command
1 [[email protected] bin] - /usr/local/mysql/bin//usr/bin/
3. Connect MySQL
1 [[email protected] bin]# MySQL-U-P2Welcome toThe MySQL Monitor. CommandsEnd with;or\g.3Your MySQL Connection ID is 14Server version:5.6. -Source Distribution5 6Copyright (c) -, the, Oracleand/orits affiliates. Allrights reserved.7 8Oracle isA registered trademark ofOracle Corporationand/or its9Affiliates. Names May trademarks oftheir respectiveTen owners. One AType'Help ;' or '\h' forHelp. Type'\c' toClear the Currentinput statement. - -Mysql>Ctrl-C--exit! theAborted
#mysql: Command not found