wget https://downloads.mysql.com/archives/get/file/mysql-5.6.36.tar.gz
yum install -y gcc gcc-c++ automake autoconf
yum -y install cmake bison-devel ncurses-devel libaio-devel
预编译:
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.36
-DMYSQL_DATADIR=/usr/local/mysql-5.6.36/data
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.6.36/tmp/mysql.sock
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_EXTRA_CHARSETS=all
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITH_ZLIB=bundled
-DWITH_SSL=bundled
-DENABLED_LOCAL_INFILE=1
-DWITH_EMBEDDED_SERVER=1
-DENABLE_DOWNLOADS=1
-DWITH_DEBUG=0
编译 && 安装:
make && make install
安装后操作:
useradd -s /sbin/nologin mysql -M
ln -s /usr/local/mysql-5.6.36 /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql/data
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/bin/cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile
. /etc/profile
chkconfig --add mysqld
/usr/local/mysql/bin/mysqladmin -u root password 'xx'
启动错误:
Starting MySQL.Logging to '/usr/local/mysql-5.6.36/data/db01.err'.
171113 13:07:01 mysqld_safe Directory '/usr/local/mysql-5.6.36/tmp' for UNIX socket file don't exists.
ERROR! The server quit without updating PID file (/usr/local/mysql-5.6.36/data/db01.pid).
mkdir /usr/local/mysql-5.6.36/tmp
chown -R mysql.mysql /usr/local/mysql-5.6.36/tmp
-----------------------------------------------------------------------------
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h iZ2zedsleruuvamkhs3he4Z password 'new-password'
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
--------------------------------------------------------------------------------