Centos 6.4 Source Installation mysql 5.6.28.tar.gz Tutorial
- 2021-06-28 14:23:38
- OfStack
mysql5.6.28 Installation Tutorial Sharing
1. Install the compilation environment before installing MySQL-5.6.28.tar.gz
yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake
2. Compile and install mysql
2.1 Add Users
groupadd mysql
useradd -g mysql mysql
2.2 Compile and Install
tar -zxvf mysql-5.6.28.tar.gz
# Installed by default /usr/local/mysql
cd mysql-5.6.28
cmake . -LH (compiled with default properties)
make && make install
Setup of 2.3.1 Compilation Parameters
cmake .
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci;
2.3.2 Full Edition
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data
-DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci;
2.4 Changing the owner of the mysql installation directory
chown -R mysql:mysql /usr/local/mysql
# Give Way mysql User, with write permissions (default)
3. Initialize the database
cd /usr/local/mysql/scripts
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
4. Copy the mysql configuration file to/etc/my.cnf
# Use default profile
cd /usr/local/mysql/support-files
cp my-default.cnf /etc/my.cnf
# Modify the configuration file to add the following
#socket Applicable to, communicating with, 1 Be sure to add
#socket Location and cmake time mysql Of -DMYSQL_UNIX_ADDR=/tmp/mysql.sock Path ,socket Path Address and Previous Address 1 kind ( otherwise mysql Service could not start properly .)
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/mysql.pid
user = mysql
socket= /tmp/mysql.sock
5. Add the mysql service to the system service and set the start-up
cd /usr/local/mysql/support-files
# Registration Services
cp mysql.server /etc/rc.d/init.d/mysql
# Give Way chkconfig Administration mysql service
chkconfig --add mysql
# Start Up
chkconfig mysql on
6. Start Mysql Service
service mysql start
# Verification mysql Start Successful
netstat -ant | grep 3306
7. Configure mysql users and modify root passwords
When Mysql starts successfully, root does not have a password by default. We need to set the root password.
Before setting the root password, set the PATH path so that commands such as mysql in /usr/local/mysql/bin can be called directly.
Modify/etc/profile file to add at the end of the file
PATH=/usr/local/mysql/bin:$PATH
export PATH
Close the file and run the following command for the configuration to take effect immediately
source /etc/profile
About how to modify root user password 1:
tar -zxvf mysql-5.6.28.tar.gz
# Installed by default /usr/local/mysql
cd mysql-5.6.28
cmake . -LH (compiled with default properties)
make && make install
0
About how to modify root user password 2:
Now, refer to the blog at https://www.ofstack.com/article/102820.htm
Log in to mysql using the root user:
tar -zxvf mysql-5.6.28.tar.gz
# Installed by default /usr/local/mysql
cd mysql-5.6.28
cmake . -LH (compiled with default properties)
make && make install
1
To set up remote access for root users, execute
tar -zxvf mysql-5.6.28.tar.gz
# Installed by default /usr/local/mysql
cd mysql-5.6.28
cmake . -LH (compiled with default properties)
make && make install
2
9. Close the firewall to prevent the remote connection from failing
1) Effective after restart
On: chkconfig iptables on
Close: chkconfig iptables off
2) Effective immediately
On: service iptables start
Close: service iptables stop
3) Open port 3306
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart
10. Change the encoding to prevent scrambling
SHOW VARIABLES LIKE 'character%'
Modify mysql, etc/my.cnf file
tar -zxvf mysql-5.6.28.tar.gz
# Installed by default /usr/local/mysql
cd mysql-5.6.28
cmake . -LH (compiled with default properties)
make && make install
4
11. Possible Errors
Question 1: Starting MySQL..The server quit without updating PID file ([FAILED]/mysql/Server03.mylinux.com.pid).
Solve:
Modify/etc/my.cnf Add socket Configuration
Question 2: ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/tmp/mysql.sock'(2)
Solve:
Create a new link or add the -S parameter to mysql to directly indicate the location of mysql.sock.
tar -zxvf mysql-5.6.28.tar.gz
# Installed by default /usr/local/mysql
cd mysql-5.6.28
cmake . -LH (compiled with default properties)
make && make install
5
12. Referenced Blog Articles
1. https://www.ofstack.com/article/102799.htm
2. https://www.ofstack.com/article/102807.htm
13. Download of Mysql: https://pan.baidu.com/s/1jHXOzMe
Exciting feature sharing: mysql different versions of installation tutorials mysql5.7 various versions of installation tutorials mysql5.6 various versions of installation tutorials