|
1, The installation dependencies
yum -y install gcc-c ++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool bison
2, the installation boost libraries:
First, first check whether installed boost
rpm -qa boost *
Uninstall old boost- * libraries like:
yum -y remove boost- *
Download Boost library, after decompression copied to / usr / local / boost directory, and then re-add options cmake -DWITH_BOOST later in options = / usr / local / boost
(Download: http: //sourceforge.net/projects/boost/files/boost/)
NOTE: boost for the 1.59.0 version mysql5.7.10 need not be other editions
Download: http: //liquidtelecom.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
3, download the source code mysql
Download the official website address: http: //cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.10.tar.gz
Download, unzip
4, the installation process
(1) Create a user group
# Groupadd mysql
# Mkdir / home / mysql # custom location
# Mkdir / home / mysql / data # custom location
# Useradd -g mysql -d / home / mysql mysql
(2) compile mysql
cmake -DCMAKE_INSTALL_PREFIX = / home / mysql -DMYSQL_DATADIR = / home / mysql / data -DDEFAULT_CHARSET = utf8 -DDEFAULT_COLLATION = utf8_general_ci -DMYSQL_TCP_PORT = 3306 -DMYSQL_USER = mysql -DWITH_MYISAM_STORAGE_ENGINE = 1 -DWITH_INNOBASE_STORAGE_ENGINE = 1 -DWITH_ARCHIVE_STORAGE_ENGINE = 1 -DWITH_BLACKHOLE_STORAGE_ENGINE = 1 - DWITH_MEMORY_STORAGE_ENGINE = 1 -DDOWNLOAD_BOOST = 1 -DWITH_BOOST = / usr / local / boost
(3) Install
The second step is not being given the case
make && make install
(4) initialize the database
Installed into the bin directory under the makeup, do
./mysqld --initialize --user = mysql --basedir = / home / mysql --datadir = / home / mysql / data
NOTE: The default password is generated after initialization, recorded
(5) adjust the configuration file parameters and environment variables
The default backup generate my.cnf
# Mv /etc/my.cnf /etc/my.cnf.bak
Enter the mysql installation directory support files directory
# Cd / mysql / support-files
Copy the configuration file for the new template configuration file mysql,
# Cp my-default.cnf /etc/my.cnf
Can be modified as needed new profile option does not modify the configuration options, mysql default configuration parameters press run.
As I modify the configuration file /etc/my.cnf, it is used to set the encoding utf8 prevent distortion
[Mysqld]
character_set_server = utf8
init_connect = 'SET NAMES utf8'
[Client]
default-character-set = utf8
Copy the startup script to the next init.d
cp /mysql/support-files/mysql.server /etc/init.d/mysqld
Increased execute permissions
chmod 755 /etc/init.d/mysqld
Create mysql command file
ln -s / mysql / bin / mysql / usr / bin /
NOTE: There is no file in this command mysql, mysql to access the database can not be used in any position
(6) start mysql
service mysqld start
(7) access the database
mysql -uroot -p
Password just generated password
(8) to modify the default password
alter user 'root' @ 'localhost' identified by '123456';
NOTE: Do not change the default password, you can not normally use sql, you must modify
This referral, mysql5.7.10 installation is complete.
Being given the record:
cmake compile time, you may encounter boost library error, cause analysis: It may be downloaded boost version and mysql requirements inconsistent versions, boost version must be specified version mysql, lower or higher than the specified version are not available. |
|
|
|