Environment Win7 Vmware12pro, virtual machine Centos6.5mini
Network adapter "Bridging mode"
Continue with the last Apache compilation, compile and install MySQL5.6
MySQL5.6 differs from previous versions in that it compiles with cmake and installs the CMake first.
#yum Install Cmake-y
1, start to download compiled MySQL5.6, recommended mirror site http://mirrors.sohu.com
#wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35.tar.gz
#tar XF mysql-5.6.35.tar.gz
#cd mysql-5.6.35.tar.gz
Yum Install ncurses-devel-y// compile will prompt to rely on Ncurses-devel, delete unzip folder, re-unzip, recompile
CMake \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/usr/local/mysql/data \
-dsysconfdir=/etc
-dmysql_unix_addr=/tmp/mysql.sock \
Many times in the Centos6.5mini environment compilation attempt, multiple errors, so the mysql.sock, files compiled to the default directory/tmp/mysql.sock
After the CMake command executes, execute the command echo $? If 0 is returned, do && make install
This compile time is long, my in 27 minutes, if your configuration is good enough, the time is less
2. Simple configuration of MySQL
Start by creating MySQL users and groups, note that MySQL users are not allowed to log in to the system, and there is no need to create home directories!
Groupadd MySQL
Useradd-m-s/sbin/nologin-g MySQL MySQL
Set MySQL installation directory owner and owner group
Chown-r Mysql:mysql/usr/local/mysql
Permission to read and write to the database data directory
chmod 777-r/usr/local/mysql/data
Copy the configuration file and service control script to the appropriate location
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
Edit the configuration file/etc/my.cnf, add:
Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data
The other parameters are good by default.
The following line initializes the database
Cd/usr/local/mysql
scripts/mysql_install_db--user=mysql
Execute echo $ again? The returned status code is 0, and the database initialization succeeds
You can start the MySQL database service, the start command is mysqld
Service mysqld Start
An uppercase "SUCCESS" indicates a successful start,
MySQL server default password is empty,
Execute/usr/local/mysql/bin/mysql to log in to the database (the default root user is the root of MySQL, not the system root)
Go to the MySQL prompt for "mysql>"
show databases; # #命令输入正确后, remember ";"
Use MySQL;
Select Host, user, password from Mysql.user;
Exit MySQL: "\q" or "Exit"
Do you remember Apache? Yes, to add the MySQL bin to the system environment variable
Echo ' Export path= $PATH:/usr/local/mysql/bin ' >/etc/profile.d/mysql.sh
chmod +x/etc/profile.d/mysql.sh
source/etc/profile.d/mysql.sh
Quit the Linux system, then log in to let the system reread the configuration file, then you can directly execute MySQL, do not write lengthy path!
Enter MySQL to open the MySQL client
>show database;
>use MySQL; # #你所有的MySQL用户和密码等信息都保存在此数据库的user表
>select user, host, password from Mysql.user; # #mysql用户名认证是基于user和host
>update user Set Password=password (' Your password ') where user= ' root ' and host= ' 127.0.0.1 ';
>flush privileges; # #更新内存数据
>set password for ' root ' @ ' localhost ' =password (' your password ');
>flush privileges;
Several common statements for MySQL:
>create database TestDB;
>use TestDB;
>create table mytest (id int (6) unsigned not NULL auto_increment, name varchar (+), age int (2), college varchar (+), h Abit blob, primary key (ID));
>desc mytest;
>insert into mytest (name, age,college,habit) value (' channel ', 32, ' Xinyang Agricultural Institute ', ' English,boxing ');
>select * from MyTest;
>update mytest set age=26 where name= ' channel ';
>select * from MyTest;
>grant all privileges in testdb.* to [email protected] "identified by ' 12345 ';
>flush privileges;
A point of inadequacy or criticism
Build and install MySQL5.6 under CentOS