Under CentOS 6.8 by compiling the source code installed MySQL 5.6.14

First, uninstall the old version
using the following command to check whether the installed MySQL Server

rpm -qa | grep mysql

Available through the following command to uninstall
the current query to us is this:

[root@hsp ~]# rpm -qa | grep mysql
mysql-libs-5.1.73-7.el6.x86_64

If the query to, delete

rpm -e mysql_libs // delete common mode
rpm -e --nodeps mysql_libs // strong delete mode, if you use the above command to delete, suggesting other files rely on, use the delete command can be strong

Second, install MySQL

Installation package compiled code needs

yum -y install make gcc-c ++ cmake bison-devel ncurses-devel
download MySQL 5.6.14 [here we have downloaded well, see the software folder]

MySQL-5.6.14.tar.gz xvf the tar
CD-MySQL 5.6.14
compiler installation [Source ----> Compiler]

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

Compile and install
make && make install
behalf to compile the installation (make install) after (make) complete

The whole process takes 5-6 minutes, you can see a small video will be 233

Third, the MySQL configuration
set permissions

Use the following command to see if there mysql users and user groups

cat / etc / passwd see the user list
cat / etc / group to view the list of user groups
if not created

groupadd mysql
useradd -g mysql mysql
修改/usr/local/mysql权限
chown -R mysql:mysql /usr/local/mysql

Initial configuration, into the installation path (in the following instruction), an initialization configuration script, the system comes to create databases and tables
CD / usr / local / MySQL
scripts / --basedir the mysql_install_db = / usr / local / MySQL --datadir = / usr / local / mysql / data --user = mysql [ this is a command]
Note: when you start the MySQL service, searches my.cnf according to a certain order, first look in the / etc directory, it will not be found Search "$ basedir / my.cnf", in this case, is /usr/local/mysql/my.cnf, which is the default location for the new version of MySQL configuration file!

Note: After installation is complete, the smallest version of CentOS 6.8 operating system, there will be a my.cnf in the / etc directory, you need this file renamed to other names, such as: /etc/my.cnf.bak, otherwise, the Source files can interfere with proper installation of MySQL configuration, resulting not start.
Change the name to prevent interference:
mv /etc/my.cnf /etc/my.cnf.bak (I have not encountered this situation, so this step is ignored)

Start MySQL
added service, copy service script to init.d directory, and set the boot
[Note executed under / usr / local / MySQL]
cp Support-Files / mysql.server /etc/init.d/mysql
chkconfig ON MySQL
Service mysql start - start MySQL

Run the following commands to modify the root password
CD / usr / local / MySQL / bin
./mysql -uroot-
MySQL> the SET PASSWORD = PASSWORD ( 'root');

Simple to use:
create a database DB1
the Create Database DB1;
create a table the User
the Create the User (the above mentioned id int name VARCHAR
(32)); . . . .
Add a user, if successful, will explain our database installation was successful!

Released seven original articles · won praise 8 · views 861

Guess you like

Origin blog.csdn.net/qq_44320146/article/details/104882879