LINUX MYSQL installation

xiaoxiao2021-03-05  24

LINUX MYSQL installation

Step 1: Download the installation package. Such as mysql-standard-4.0.16-pc-linux-i686.tar.gz download is www.mysql.com Recommended storage directory is: / usr / local / this is also mysql [Installation Path], [Installation Path] can be anywhere. Here [Install Path] == / USR / LOCAL /

Step 2: Create a new group mysql and new account mysql, which is considered for security factors.

Shell> GroupAdd Mysql Shell> UserAdd -g MySQL MySQL

Step 3: Unzip files, establish a connection directory mysql /

Shell> CD [Installation Path] Shell> TAR ZXVF mysql-standard-4.0.16-pc-linux-i686.tar.gz shell> ln -s mysql-standard-4.0.16-pc-linux-i686 mysql shell> CD mysql

(BTW: Need to write path = [installation path] / bin to read the user's PATH environment that you need to read Mysql)

Step 4: Change the home of the mysql installation directory, change to mysql, which is also considered for security factors. Shell> chown -r mysql: mysql [Installation Path] Step 5: Perform the installation command, you can switch to the mysql user, or execute under root. Shell> Su - mysql shell> ./scripts/mysql_install_db --dataDir = [Installation path] / data (Description :/scripts/mysql_install_db, if you don't force the specified (--DATADIR =), the program will default by default. / var / lib / mysql, if not a root user, execute ./scripts/mysql_install_db will encounter the problem of insufficient permissions.)

Step 6: Shell> Mkdir log shell> Su - shell> cp /etc/my.cnf. Shell> vi my.cnf

(Description: # 程序 会 The default is read to the /etc/my.cnf file to get the configuration, so it is recommended to copy the /etc/my.cnf file to / usr / local / mysql / below .my.cnf) Modify the file my. The CNF is as follows: ----------------------------------------------- ------ [MySQLD] datadir = [Installation Path] / DataSocket = [Installation Path] /Data/mysql.sockport = 3406 (Description: The port can be arbitrarily specified, as long as you do not conflict)

[mysql.server] user = mysqlbasedir = .. / [Installation Path] Previous Directory for [Installation Path])

[SAFE_MYSQLD] err-log = [Installation path] /Log/mysqld.logpid-file = [Installation path] /Log/mysqld.pid -------------------- ---------------------------------- Step 7: # When you start mysqld_safe, run as follows: Shell > ./bin/mysqld_safe --defaults-file =. / my.cnf --skip-grant-tables & # can enter mysql without a password. # Then it is shell> cd bin ;./mysql -h 127.0.0.1 --port = 3406 -u root -p Enter Password: [Enter] mysql> Update user set password = password ("new_pass" Where User = "root"; mysql> flush privileges; if mysql needs password verification, then the following operation # 重 mSQL, start mysql shell> ps -fd | grep mysqld shell> killall mysqld shell> ./bin/mysqld_safe -defaults-file =. / my.cnf -o max_allowed_packet = 1m &

Other commands:

First, add a database user (browse users): shell> mysql -u root -p mysql> use mysql mysql> Insert INTO User (Host, User, Password) Values ​​('localhost', 'username ", password (' user_password" ); Mysql> flush privilegeg; 2, authorization shell> mysql --user = root mysqlmysql> grant select, insert, update, delete, create, drop on bankaccount. * To custom @ localhost identified by 'stupid';

August 24, 2004

转载请注明原文地址:https://www.9cbs.com/read-36119.html

New Post(0)