Linux Use under mysql The command needs to configure the environment and various files , The following is compiled by the learning editor linux lower mysql Knowledge that commands cannot be used , I hope it will help you !

linux of mysql The command doesn't work

1. Reinstall mysql command , The method steps are as follows :

one Installation steps

Download the version you need from here ( Note that choosing your operating system is 64 Bit or 32 Bit ):

Here are only two judgments linux yes 64 Bit or 32 Method of :

command :file /bin/cat

[root@app3 config]# file /bin/cat

/bin/cat: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.4.0, dynamically linked (uses shared libs), stripped

32-bit That is 32 Bit linux, So 64 Bit , It shows 64-bit

command :uname -m

[root@app3 config]# uname -m

x86_64

ditto

Commonly used in development msyql Binary package decompression and installation , I don't like the previous way of compiling and installing . In fact, the installation process depends on the documents on the official website , Now? 5.1 and 5.5 The installation process of binary installation packages is the same :Installing
MySQL from Generic Binaries on Unix/Linux

mysql The installation of is not difficult at all , All operations come together , Just the following commands , The copy is completed in one run mysql Installation process of , Isn't it simple !

groupadd mysql

useradd -r -g mysql mysql

cd /usr/local

tar zxvf /path/to/mysql-VERSION-OS.tar.gz

ln -s full-path-to-mysql-VERSION-OS mysql

cd mysql

chown -R mysql .

chgrp -R mysql .

scripts/mysql_install_db --user=mysql

chown -R root .

chown -R mysql data

# Next command is optional

cp support-files/my-medium.cnf /etc/my.cnf

bin/mysqld_safe --user=mysql &

# Next command is optional

cp support-files/mysql.server /etc/init.d/mysql.server

Note that the installation is complete , Environment variables need to be set , People who install for the first time must remember to set the environment variable ,linux Will go /usr/local/mysql/bin Look in the directory mysql
command , Otherwise you enter mysql Command error :“-bash: mysql: command not found”

two set up mysql environment variable

If not available mysql command , Do the following : hold export PATH=$PATH:/usr/local/mysql/bin Add to /etc/profile in .

three Special reminder

You may encounter problems during installation :Manager of pid-file quit without updating file.

that is because : 1. The original data file has not been deleted .2. Modify directory ownership and configuration files .

Execute the following command :

rm -rf /var/lib/mysql

Then repeat the following steps :

cd mysql_directory

scripts/mysql_install_db --user=mysql

chown -R root .

chown -R mysql data

chgrp -R mysql .

cp support-files/mysql.server /etc/init.d/mysql

cp support-files/my-medium.cnf /etc/my.cnf

mysql_install_directory The directory is generally : /usr/local/mysql/;
There is a benefit to using this directory , You don't have to modify it yourself basedir and datadir Profile parameters (/etc/my.cnf in ) and sock Parameters of .

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.soc :

1. This is not configured well my.cnf file . Specific configurations can be google. 2. Not started mysql service .

supplement :

In recent use , Some people in the group use it linux of mysql User startup mysql, Some people use root User startup mysql. This leads to problems ,root After user startup ,mysql The user cannot start msyql Yes , Lost relevance mysql File access . Need attention !!

Technology
©2019-2020 Toolsou All rights reserved,
Android Using wechat in H5 Payment result refresh during payment shock !!C++ Can make a sound ! Basic operation of single linked list C Language explanation Java Implement an epidemic number management system 2021 year 11 World programming language ranking linux upper mysql Invalid command _linux lower mysql The command is useless Java project : Campus dormitory management system (java+jsp+javaweb+mysql+ajax) Wechat applet development project directory linux ubuntu Which version ,Ubuntu Which version is the best ?python Code painting cherry blossoms - How to use Python Draw a beautiful cherry blossom