Delete the default default MySQL;
[[email protected] ~]# rpm-qa|grep mysql//query mysql is installed
[[email protected] ~]# rpm-e mysql//normal Delete mode
[[email protected] ~]# rpm-e--nodeps mysql//forced delete mode, do not delete dependent packages
If any of the above problems can be uninstalled using yum remove MySQL.
===================================================================================
MySQL5.7 Source Package Installation:
Yum-y Install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool Bison
cd/data/
wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
Tar zxvf boost_1_59_0.tar.gz-c/usr/local/src/boost
Tar zxvf mysql-5.7.11.tar.gz-c/usr/local/src/cd/usr/local/src/mysql-5.7.11
Mkdir-p/home/mysql/data
Mkdir-p/home/mysql/logs
Mkdir-p/home/mysql/temp
CMake \
-DCMAKE_INSTALL_PREFIX=/USR/LOCAL/MYSQL57 \
-dmysql_unix_addr=/usr/local/mysql57/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-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 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=/home/mysql/data \
-dmysql_user=mysql \-dmysql_tcp_port=3306 \
-denable_downloads=1-dwith_boost=/usr/local/src/boost_1_59_0
Make & make Install
Chown-r mysql:mysql/usr/local/mysql57
Chown-r Mysql:mysq/home/mysql
Copy the service to/etc/init.d/mysqld.
Cp/usr/local/mysql57/bin/mysqld/etc/init.d/mysqld
Start MySQL service;
Chkconfig mysqld on
Initializing the database
/usr/local/mysql57/bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql57--datadir=/home/mysql/data
Adjusting the configuration file
Mv/etc/my.cnf/etc/my.cnf.bak-------//Add "Skip-grant-tables" to my.cnf to password-free login;
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Stop the database;
[[Email protected] mysql57]# service mysqld stop
Safe mode to start the database;
[Email protected] mysql57]#/usr/local/mysql57/bin/mysqld_safe--skip-grant-tables &
Change the password;
mysql> UPDATE mysql.user SET authentication_string=password (' Sheng ') WHERE user= ' root ' and host= ' localhost ';
mysql> flush Privileges;
Mysql> quit restart database;
[Email protected] mysql57]# service mysqld restart
Log in to Database
[Email protected] ~]# mysql-u root-p
Prompt to force a password change to use other statements;
mysql> alter user ' root ' @ ' localhost ' identified by ' Sheng ';
========================================================================================
Install MySQL from the Yum Source:
[[email protected] ~]# Yum list |grep MySQL
[email protected] ~]# yum install-y mysql-server MySQL Mysql-deve
[Email protected] ~]# Rpm-qi mysql-server
Start the MySQL database;
[[Email protected] ~]# service mysqld start
[Email protected] ~]# Chkconfig--list | grep mysqld start MySQL;
[Email protected] ~]# chkconfig mysqld on
Create the MySQL database root password
[Email protected] ~]# mysqladmin-u root password ' sheng '
Main configuration file for MySQL database
/ETC/MY.CNF This is the main configuration file for MySQL
/var/lib/mysql database file storage location for MySQL database
=========================================================================================
Log in to the database using the root account password;
[Email protected] data]# mysql-u root-p
Database common commands;
View database: show databases;
Creating a database: Create databases database_name;
Delete database: drop databases database_name;
MySQL-supported engine; show engines \g;
Using the database: use database_name;
Displays the contents of the database: show CREATE DATABASE database_name \g;
Show the created data table; show tables;
View table Detail Structure statement show create table;
View the contents of the table; describe table_name;
Delete data table drop TABLE table_name;
=====================================================================================
MySQL5.7 Installation