MySQL-5.6.10 and MySQL-5.5.34 for source code compilation and installation on CentOS 6.2

Source: Internet
Author: User
Tags localhost mysql

MySQL-5.6.10 and MySQL-5.5.34 for source code compilation and installation on CentOS 6.2

1. Install Mysql5.6.10


1. necessary software:
Yum-y install gcc-c ++ autoconf automake bison ncurses-devel libtool-ltdl-devel * cmake make
Ii. Compilation and Installation
[Root @ localhost src] # groupadd mysql
[Root @ localhost src] # useradd mysql-g mysql
[Root @ localhost src] # pwd
/Usr/local/src
[Root @ localhost src] # mkdir/data/mysql/data-p
[Root @ localhost src] # mkdir/usr/local/mysql
[Root @ localhost src] # ls
Mysql-5.6.10.tar.gz
Cm/pwd [root @ localhost src] # tar-zvxf mysql-5.6.10.tar.gz
The Cmake software can be compiled or installed without compilation. No problems have been found during non-compilation and installation.
The Rpm package cmake is 2.6.4-5 in centos. el6 as to why cmake is compiled and installed, I personally think it is because there is no rhel5 or the version is too low. Some mysql installations are still carried out on rhel5. On the cmake official website, 2.6.4 is always the same as the two versions. download available
Download cmake11.2.1
[Root @ localhost src] # wget http://wwwNaNake.org/files/v2.8/cmake-2.8.12.1.tar.gz
[Root @ localhost src] # tar-zvxf cmake-2.8.12.1.tar.gz
[Root @ localhost src] # cd cmake-2.8.12.1
[Root @ localhost cmake-2.8.12.1] #./bootstrap
[Root @ localhost cmake-2.8.12.1] # make & make install
[Root @ localhost cmake-2.8.12.1] # cmake -- help | head-n1
Cmake version 2.8.12.1
[Root @ localhost cmake-2.8.12.1] # cd/usr/local/src/mysql-5.6.10/storage
Which storage engines Support reading a directory?
[Root @ localhost storage] # ls
Archive csv federated innobase myisammrg perfschema
Blackhole example heap myisam ndb
[Root @ localhost storage] # pwd
/Usr/local/src/mysql-5.6.10/storage


[Root @ localhost storage] # cd/usr/local/src/mysql-5.6.10.
[Root @ localhost mysql-5.6.10] # cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \
-DMYSQL_DATADIR =/data/mysql/data /\
-DSYSCONFDIR =/etc \
-DWITH_TCP_PORT = 3306 \
-DMYSQL_USER = mysql \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_EXTRA_CHARSETS: STRING = all \
-DENABLED_LOCAL_INFILE = 1 \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1

 


Parameter configuration details:
In fact, in version 5.6, all engine parameters can be left blank because all parameters are installed by default.
But 5.5 is different about-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_FEDERATED_STORAGE_ENGINE = 1 \ these three must be filled in by yourself; otherwise, only six engines can be compiled;
#/*-DWITH_READLINE = 1 # shortcut key function
#/*-DMYSQL_UNIX_ADDR =/usr/local/mysql/mysqld. sock # connect to the database socket path
#/*-DMYSQL_TCP_PORT = 3306 # Port
#/*-DENABLED_LOCAL_INFILE = 1 # Allow Local Data Import

 


[Root @ localhost src] # make & make install
[Root @ localhost src] # cd/usr/local/mysql/scripts/
[Root @ localhostsrc] #./mysql_install_db -- user = mysql -- datadir =/data/mysql/data -- basedir =/usr/local/mysql
[Root @ localhost src] # cd/usr/local/mysql/support-files/
[Root @ localhost src] # cp mysql. server/etc/init. d/mysqld
[Root @ localhost src] # chmod 755/etc/init. d/mysqld

 


[Root @ localhost src] # cat>/etc/profile <EOF
Export PATH = $ PATH:/usr/local/mysql/bin
EOF
[Root @ localhost src] # source/etc/profile
[Root @ localhost src] # cd/usr/local/mysql/support-files/
[Root @ localhost support-files] # cp-f my-default.cnf/etc/my. cnf
[Root @ localhost support-files] # cat>/etc/my. cnf <EOF
Log-bin = mysql-bin
Expire_logs_days = 10
Binlog_format = mixed
Table_definition_cached = 10000
Max_connections = 1000
Key_buffer_size = 256 M
Tmp_table_size = 64 M
Read_buffer_size = 4 M
Read_rnd_buffer_size = 16 M
Sort_buffer_size = 64 M
Thread_cache_size = 80
Wait_timeout = 7200
Thread_concurrency = 8
Innodb_buffer_pool_size = 1024 M
Innodb_sort_buffer_size = 4 M
Innodb_thread_concurrency = 4
Innodb_flush_logs_at_trx_commit = 2
EOF


[Root @ client100 support-files] # chown mysql. mysql/etc/my. cnf
# Change the owner of the installation directory to mysql [changed above, and then changed to the root owner here, so you can change it to mysql]
[Root @ client100 support-files] # chkconfig -- add mysqld
[Root @ client100 support-files] # chkconfig mysqld on
[Root @ localhost support-files] # chkconfig -- list | grep mysql -- 234 must be on
[Root @ client100 support-files] # service mysqld start


[Root @ client100 support-files] # echo "drop user 'root' @ ': 1'; drop user'' @ 'localhost '; drop user 'root' @ 'localhost. localdomain '; "| mysql
[Root @ client100 support-files] # mysqladmin-u root password '000000'


---------------------------------------------------------------------


If an error is reported in the database, there are usually two possible causes.
First, you [root @ localhostsrc] #. /mysql_install_db -- user = mysql -- datadir =/data/mysql/data -- basedir =/usr/local/mysql path incorrect. Then execute this sentence again.
The second is caused by the fact that your old database is not closed or you have performed service mysqld start multiple times. The solution is as follows:
[Root @ localhost support-files] # service mysqld restart
ERROR! MySQL server PID file cocould not be found!
Starting MySQL... ERROR! The server quit without updating PID file (/data/mysql/data/localhost. localdomain. pid ).
[Root @ localhost support-files] # ps-ef | grep mysql
Root 47388 1 0 00:00:00 pts/0/bin/sh/usr/local/mysql/bin/mysqld_safe -- datadir =/data/mysql/data -- pid-file =/data/ mysql/data/localhost. localdomain. pid
Mysql 47503 47388 0 00:00:00 pts/0/usr/local/mysql/bin/mysqld -- basedir =/usr/local/mysql -- datadir =/data/mysql/data -- plugin- dir =/usr/local/mysql/lib/plugin -- user = mysql -- log-error =/data/mysql/data/localhost. localdomain. err -- pid-file =/data/mysql/data/localhost. localdomain. pid
Root 62679 11100 0 00:00:00 pts/0 grep mysql
[Root @ localhost support-files] # kill-9 47503
[Root @ localhost support-files] # service mysqld restart
ERROR! MySQL server PID file cocould not be found!
Starting MySQL... SUCCESS!

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.