Install mysql in linux and mysql in linux
1. Download mysql. Here I advocate binary installation.
Use winSCP to transmit the downloaded mysql to the linux Server
2. decompress the downloaded mysql package
#tar -zxvf /{MySQL5.6_path}/mysql-{version}.tar.gz
Here there are four parameters, representing
X: extract the file from the tar package; z: indicates that the tar package is compressed;
V: Show Details. f: xxx.tar.gz: specifies that the file to be processed is xx.tar.gz.
3. Modify the name
#mv mysql-5.6.20-linux-glibc2.5-i686 mysql
4. Copy the extracted mysql file to/usr/local.
#cp /mysql /usr/local
5. Modify the creator and creation group of folders and files at various levels of mysql as mysql (note that the statement is followed by
.)
Cd mysqlchown-R mysql. <pre name = "code" class = "plain"> // change the owner of the current directory to a mysql user and add the-R parameter. This parameter indicates looping through subnodes. All sub-nodes work
Chgrp-R mysql.
// Change all groups in the current directory to the mysql Group
6. At this point, mysql has been installed, but Initialization is required. initialize mysql tables, test tables, and infomation tables.
#scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
#cp support-files/mysql.server /etc/init.d/mysqld
7. modify the configuration file
# Cp my. cnf/etc/my. cnf/usr/local/mysql [root @ 10-4-5-9 mysql] # vi/etc/my. add basedir =/usr/local/mysqldatadir =/usr/local/mysql/dataport = 3306server_id = 1 to cnf [mysqld]
8. Start the mySQL Service
Bin/mysqld_safe -- user = mysql & // "&" indicates running in the background
Steps:
Step 1: Check whether mysql is successfully installed.
One way is to check whether port 3306 is enabled.
Command: netstat-ntl can list all listening ports
Method 2: Use the mysql command to connect to the server once.
Command:
/usr/bin# mysql -uroot -piamnts