###### #Redhat6.5 source code compilation installation mysql########
Lab Environment:
1.ip:172.25.8.3
2. Disk to be larger than 20G
First, add a piece of disk larger than 20G
FDISK/DEV/VDB # #得到/DEV/VDB1 8e Linux
PVCREATE/DEV/VDB1 # #把物理分区做成物理卷
Vgextend VG_SERVER1/DEV/VDB1 # #把新建立的/DEV/VDB1 added to Vg_server1
Lvextend-l 20g/dev/vg_server1/lv_root # #扩大lvm扩展到到20G
Resize2fs/dev/vg_server1/lv_root # #格式化文件系统
Experimental content:
1. Clean up the environment
Rpm-qa|grep MySQL # #检查mysql版本
Rpm-e|grep MySQL # #卸载mysql
2. Installation
Mysql-boost-5.7.11.tar.gz # #boost是一个可移植, a C + + library that provides source code
CMAKE-2.8.12.2-4.EL6.X86_64.RPM # #新版mysql用cmake编译安装 (CMake is a compilation tool, higher than make, By writing the CMakeList.txt file, and then cmake the command to convert the CMakeList.txt file to the makefile required for make, the final make command compiles the source to generate an executable program or shared library)
Tar zxf mysql-boost-5.7.11.tar.gz # #进行解压
Yum install-y cmake-2.8.12.2-4.el6.x86_64.rpm # #进行安装
Yum install-y gcc gcc-c++ make ncurses-devel bison openssl-devel zlib-devel cmake # #安装包依赖性
cd/root/mysql-5.7.11 # #进入目录
CMake # #cmake命令安装
>-dcmake_install_prefix=/usr/local/lnmp/mysql \ # #指定mysql安装目录, default/usr/loacl/mysql
>-dmysql_datadir=/usr/local/lnmp/mysql/data \ # #数据文件目录
>-dmysql_unix_addr=/usr/local/lnmp/mysql/data/mysql.sock \ # #socket文件路径, default/tmp/mysql.sock
>-dwith_myisam_storage_engine=1 \ # #安装myisam存储引擎
>-dwith_innobase_storage_engine=1 \ # #安装innodb存储引擎
>-dwith_boost=boost/boost_1_59_0 \ # #boost库
>-ddefault_charset=utf8 \ # #使用utf8字符
>-ddefault_collation=utf8_general_ci \ # #校验字符
>-dextra_charsets=all # #安装所有扩展字符集
(Rm-f CMakeCache.txt # #编译过程中缺什么安装什么, more what to delete, generally in the installation package dependencies, this time for the experiment is not completely resolved
Yum install-y ncurses-devel gcc-c++ Bison # #ncurses-devel character terminal under screen control Basic Library, gcc-c++)
Make # #make时间比较长
Make install
Useradd-u 27-m-d/usr/local/lnmp/mysql/data-s/sbin/nologin mysql ##-m do not automatically set up the user's log in directory
Groupmod-g MySQL
Chown Mysql.mysql/usr/local/lnmp/mysql-r # #修改目录所属人和组
Cd/usr/local/lnmp/mysql # #进入目录
CP/USR/LOCAL/LNMP/MYSQL/SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF # #覆盖/ETC/MY.CNF
CP/ETC/MY.CNF/ETC/MY.CNF.RPM # #备份一份my. CNF, for my.cnf.rpm
CP/USR/LOCAL/LNMP/MYSQL/SUPPORT-FILES/MYSQL.SERVER/ETC/INIT.D/MYSQLD # #mysql启动脚本复制到/etc/init.d/
Vim ~~/.bash_profile # #编辑文件, specify environment variables, add a colon after path:/usr/local/lnmp/mysql/bin
source. Bash_profile # #刷新. Bash_profile, view with Echo $PATH
mysql_install_db--user=mysql--basedir=/usr/local/lnmp/mysql--datadir=/usr/local/lnmp/mysql/data
# #mysql_install_db是一个初始化脚本, used to initialize the data directory and create those system tables, as well as initialize the system tablespace and correlate InnoDB tables and data structures. --USER Specifies to run the user for the Mysqld service,--basedir Specify the installation directory,--datadir specify the data storage directory
Mysql_secure_installation # #mysql安全配置向导, 1) Add password for root 2) Delete anonymous account 3) remove root telnet 4) Delete test library and access to test Library 5) Refresh authorization form to make changes effective
Mysql-uroot-predhat can login successfully
To modify the password:mysql> alter user [email protected] identified by ' Westos '; Then sign in with the new password
Added: MySQL forgot password
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
1.vim/etc/my.cnf
[Mysqld]
Skip-grant-tables # #添加这句
2. Restart the MYSQLD service
3.mysql command go directly to reset password
mysql> Update Mysql.user Set Authentication_string=password (' Redhat ') where user= ' root ' and host= ' localhost ';
mysql> flush Privileges;
Mysql> Grant All on * * to ' root ' @ ' localhost ' identified by ' Redhat ' with GRANT option;
mysql> flush Privileges;
4.vim/etc/my.cnf
[Mysqld]
#skip-grant-tables # #注释这句或者删除
5. Restart the MYSQLD service
6.mysql-uroot-predhat can login successfully
This article from the "12148275" blog, reproduced please contact the author!
Linux Learning Notes-source code compilation install MySQL