mysql 官网下载 tar包
1G 内存的话建议安装 5.6版本,5.7版本消耗内存根本吃不消
MySQl 官网下载选项
https://dev.mysql.com/downloads/mysql/
MySQL Community Server 5.6.37
Select Version: 5.6.37
Select Operating System: Source Code
Select OS Version: Generic Linux
yum install bison cmake
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0
make
make install
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
===
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 iZwz9bx5oesz31ozyxls5eZ 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 ;
/usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
cp support-files/my-medium.cnf /etc/my.cnf
设置 MySQL 启动项
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chown -R mysql:mysql /usr/local/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'