Official website mysql download address:
ftp://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/
Download: mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz
system environment
[root@db02 ~]# uname -r 2.6.32-696.el6.x86_64 [root@db02 ~]# uname -m x86_64 [root@db02 ~]# cat /etc/redhat-release CentOS release 6.9 (Final)
Install mysql5.6.38 binary installation
1. Unzip the binary package
Upload the package to the linux server and decompress it
tar -zxf mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz
2. Move the mysql decompressed package to the program directory (/application/) and rename it
mkdir -p /application/ mv mysql-5.6.38-linux-glibc2.12-x86_64 /application/mysql-5.6.38
3. Create a soft link for the mysql service program
ln -s /application/mysql-5.6.38/ /application/mysql
4. Add the administrative user when the mysql program is running
useradd -s /sbin/nologin -M mysql id mysql
5. Let the mysql user manage /application/mysql/data
chown -R mysql.mysql data
6. Initialize the database
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
7. Copy startup script authorization
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld
8. Modify the path in the startup script and the mysql command
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
9. Copy the default configuration file
\cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
10. Start mysql
/etc/init.d/mysqld start
View process service port
netstat -lntup | grep 3306 ps -ef | grep mysql
manage mysql database
1. How to enter and exit the mysql database
/application/mysql/bin/mysql This is the command to start mysql, simplify the command
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile source /etc/profile which mysql
When exiting mysql, try not to use ctrl+c to exit mysql, but use ctrl+d to exit mysql
2. Set the mysql service to start automatically at boot
chkconfig --add mysqld chkconfig mysqld on chkconfig --list mysqld
3. Set mysql login user name and password (default no password)
# 给出的提示信息 # PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! # To do so, start the server, then issue the following commands: # /application/mysql/bin/mysqladmin -u root password 'new-password' # /application/mysql/bin/mysqladmin -u root -h web01 password 'new-password' # 给root用户设置密码 /application/mysql/bin/mysqladmin -u root password 'oldboy123'
4. Enter the mysql database mode
方式1: [root@web01 ~]# mysql -u root -poldboy123 Warning: Using a password on the command line interface can be insecure. 方式2: [root@web01 ~]# mysql -u root -p Enter password:
Note:
This blog post is for readers' reference only. Readers should configure and install reasonably according to the server they use!
Thanks for reading!