Original address: https://www.cnblogs.com/netsa/p/7088494.html
Brief steps:
mysql5.6.25 Compile the installation steps:
Download MySQL
Prepare users and Groups
Yum installation Dependencies
Unzip MySQL
CMake compiling MySQL
Make && make install----time approx. 10 minutes
MySQL Install directory permissions settings
Database initialization
Copy configuration file
Root password reset, the original is no password
Remote Account Authorization
Set up service startup and boot up
====== Combat ==============================
#安装依赖
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel perl vim
#准备用户和组
Groupadd MySQL
Useradd mysql-g mysql-m-s/sbin/nologin
#下载mysql 5.6.25
Wget-c https://downloads.mysql.com/archives/get/file/mysql-5.6.25.tar.gz
#-c representative supports breakpoint continuation
#解压包
TAR-ZXVF mysql-5.6.25.tar.gz
#进入解压后的目录
CD mysql-5.6.25
# Start compiling, you can modify the directory and port Yourself
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=/tmp/mysqld.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
#编译完成后安装 (time approx. 20 min)
Make && make install
#如果需要重新编译要删除 (optional)
RM-RF CMakeCache.txt
#目录授权
Chown Mysq:mysql/usr/local/mysql
#数据库初始化, it is important to note the way the script is executed and the correctness of the initialization parameters, otherwise it will cause unsuccessful initialization and will not create the MySQL library. Take a closer look at the success hints for initialization
The success is similar to the following:
Cd/usr/local/mysql
./scripts/mysql_install_db--user=mysql--datadir=/usr/local/mysql/data
#拷贝配置文件
CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF
#修改my. CNF Configuration
Vim/etc/my.cnf
[Mysqld] Add:
51datadir=/usr/local/mysql/data
52default-storage-engine=innodb
53lower_case_table_names=1
#设置环境变量
[Email protected] ~]# Vi/root/.bash_profile
In modifying the path= $PATH: $HOME/bin is:
Path= $PATH: $HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
[[email protected] ~]# source/root/.bash_profile//Make the changes take effect
#传统启动方式启动
Bin/mysqld_safe--user=mysql &
#启动mysql to see if it's successful.
Netstat-tnl|grep 3306
#制作成服务启动
CP Support-files/mysql.server/etc/init.d/mysql
Related commands:
Service MySQL Start
#停止mysql服务
Service MySQL Stop
#重启mysql服务
Service MySQL Restart
#添加到开机启动项
Chkconfig--add MySQL
#修改root密码 (if MySQL starts successfully)
Cd/usr/local/mysql
#./bin/mysqladmin-u Root Password
#mysql account access authorization and Remote access authorization and password modification
[[email protected] mysql]# mysql-u root MySQL
mysql> use MySQL;
mysql> desc User;
Mysql> GRANT All privileges on * * to [email protected] '% ' identified by ' root '; The ability to add remote connections for root
mysql> Update user Set Password = Password (' 123456 ') where user= ' root '; Set the root user password
Mysql> Select Host,user,password from User where user= ' root ';
mysql> flush Privileges;
Mysql> exit
#至此mysql安装完成, go to MySQL
Mysql-uroot-p
Enter the password as prompted.
?
#清理mysql账户
Remove all of the root link information in the user table except localhost and 127.0.0.1.
mysql5.6.25 Compile the installation step (this is I copy others, easy to see)