1 Check if MySQL is installed on the machine
Rpm-qa | grep MySQL
2. Delete the existing MySQL
Rpm-e--nodeps MySQL () brute force delete mode)
3. Install the packages required for compiling the code
Yum-y install gcc gcc-devel gcc-c++ gcc-c++-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libt ool* cmake OpenSSL openssl-devel Bison bison-devel unzip-y
4. Unzip the compiler: TAR-ZXVF mysql-5.6.14.tar.gz
CD mysql-5.6.14
Compile and install: mysql5.5 later compile and install using CMake
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=/var/lib/mysql/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
*********************************************************************
If an error occurs:
CMake.
--MySQL 5.5.8
--Could not find Curses (missing:curses_library curses_include_path)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses Library not found. Please install the appropriate package,
Remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package name was Libncurses5-dev, on Redhat and derivates it was ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:126 (find_curses)
cmake/readline.cmake:216 (Mysql_use_bundled_libedit)
cmakelists.txt:256 (Mysql_check_readline)
--Configuring incomplete, Errors occurred!
You will need to install Yum-y installation ncurses-devel-y ******* and delete the CMakeCache.txt file. Re-compile once and then OK
5 Make && make install
6. Create MySQL user and MySQL group
Groupadd MySQL
Useradd-s/sbin/nologin-g mysql-m MySQL
-M: Do not create home directory
7. Modify/usr/local/mysql Permissions
Chown-r Mysql:mysql/usr/local/mysql
8 ...
Enter the installation path, execute the initialization configuration script, create the system's own database and table
Cd/usr/local/mysql
scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql
9 Starting the database
/usr/local/mysql/bin/mysqld_safe &
10 Add service, Copy Service script to INIT.D directory
CP Support-files/mysql.server/etc/init.d/mysqld
Chkconfig MySQL on
/etc/init.d/mysqld start
11 Configuring the MySQL Global usage path
Vim/etc/profile
Added path= $PATH:/usr/local/mysql/bin/
Echo $PATH
12:source/etc/profile
Make path effective
MySQL login command
Mysql-u root-p
Modify MySQL login password (default is empty)
mysqladmin-u root password ' 123456 '
15 Viewing the system comes with a table
Mysql>show databases;
16 to set the root user to have remote access, execute
Mysql> GRANT All privileges on * * to ' root ' @ ' 192.168.% ' identified by ' 123456 ' with GRANT OPTION; When the red password is remote access, the root user's password can be different from the local.
17 Firewall 3306 port is not turned on by default, to remote access, you need to open this port
Vim/etc/sysconfig/iptables
-A input-m state--state new-m tcp-p-dport 3306-j ACCEPT
This article is from "Linux Ops beginner" blog, please make sure to keep this source http://ht712.blog.51cto.com/9397612/1555060
centos6.5 Compiling and installing mysql5.6.14