Some summary of installing MySQL under Linux, share under.
Test environment: CentOS6.6
: HTTPS://WWW.PERCONA.COM/DOWNLOADS/PERCONA-SERVER-5.6/PERCONA-SERVER-5.6.28-76.1/
Installation version: percona-server-5.6 (or 5.5)
Binary Package Installation process:
Premise:
1. Firewall off (if no firewall policy is made)
2.selinux off
Deployment:
1. Dependent Package Installation:
Yum-y Install openssl098e.x86_64 openssl.x86_64 openssl-devel.x86_64
Dependent packages that may be required:
Yum-y Install compat-readline5.x86_64
Perl Module Installation:
Yum install-y perl-dbd-mysql.x86_64 Perl-io-socket-ssl.noarch
2. Catalog creation
Data directory:
Mkdir-pv/data/mysql/datadir/m1/data
Mkdir-pv/data/mysql/datadir/m1/tmp
Log directory:
Mkdir-pv/data/mysql/logdir/m1/logs
Configuration file directory:
Mkdir-pv/data/mysql/config
Socket directory:
Mkdir-pv/data/mysql/socket
(Note 1:m1: Instance name, arbitrarily specified, multi-instance case, used to differentiate the path)
(Note 2:/data Storage mount directory, for separate from other business directory, create MySQL directory, put data,log,config,socket related files directory.) These directories need to be specified in the configuration file, otherwise unrecognized)
3. Create user (can be non-MySQL, only when using--USER=XX, specify on line)
Groupadd MySQL
useradd-g MySQL MySQL
4. Install MySQL
<1> unzip the:< in advance to upload the package to/data below >
Execute command:
cd/data/
TAR-XF percona-server-5.6.28-rel76.1-linux.x86_64.ssl098e.tar.gz
<2> renaming
MV Percona-server-5.6.28-rel76.1-linux.x86_64.ssl098e.tar.gz mysql5628
<3> Soft Chain
Ln-s/data/mysql5628/usr/local/mysql
5. Environment variable Settings
Vim/etc/profile
Export path= $PATH:/usr/local/mysql/bin
tmout=600 #超时时间需要设置长点, otherwise the screen shows always interrupted
Save Exit!
Execution: Source/etc/profile
6. Configuration file (package has the configuration file)
/data/config/my3306.cnf
Some of the main path parameters:
[Mysqld]
Basedir =/usr/local/mysql
DataDir =/data/mysql/datadir/m1/data
Tmpdir =/data/mysql/datadir/m1/tmp
Socket =/data/mysql/socket/mysql3306.sock
Pid-file =/data/mysql/socket/mysql3306.pid
Log-bin =/data/mysql/logdir/m1/logs/mysql-bin
Log-error =/data/mysql/logdir/m1/m1_err.log
Slow-query-log-file =/data/mysql/logdir/m1/m1_slow.log
#innodb
Innodb_data_home_dir =/data/mysql/datadir/m1/data
Innodb_log_group_home_dir =/data/mysql/logdir/m1/logs
Innodb_data_file_path = Ibdata1:1g:autoextend
Innodb_buffer_pool_size = 4G #根据服务器内存大小调整 (single instance, local memory 70%~80% bar)
7. Empowerment: Group (for the convenience of the group and users are MySQL permissions, detailed reference to the Official Document installation section)
Chown-r Mysql.mysql/data/mysql
Chown-r Mysql.mysql/usr/local/mysql
8. Initialize (initialize successfully will show OK ...) Ok.. There are also some information to start. If the initialization, the end of a few seconds, congratulations on your estimation of a problem, suggest to see Err_log)
cd/usr/local/mysql/
./scripts/mysql_install_db--defaults-file=/data/config/my3306.cnf--user=mysql
9. Starting mode:
./bin/mysqld_safe--defaults-file=/data/config/my3306.cnf--user=mysql &
10. Login Method:
Mysql-uroot-p-s/data/mysql/socket/mysql3306.sock
(Note: First root login, no password, direct login, enter, into the library)
11. View Current User
Select User,host,password from Mysql.user;
To clear a useless user:
Delete from Mysql.user where user= ' or host! = ' localhost ';
To set the root password:
Grant all privileges on * * to [e-mail protected] ' localhost ' identified by ' [E-mail protected]!1234 ' with GRANT option;
Set Administrator account:
Grant all privileges on * * to [email protected] '% ' identified by ' [email protected]!1234 ' with GRANT option;
Grant all privileges on * * to [e-mail protected] ' localhost ' identified by ' [E-mail protected]!1234 ' with GRANT option;
To set up a regular account:
Grant Select,delete,insert, UPDATE, CREATE, Process,alter on db1.* to [email protected] '% ' identified by ' userpasswd ';
Refresh permissions:
Flush privileges;
---OK
[Note: If the content is wrong, hope to point out, common progress]
This article is from the "Breeze" blog, please be sure to keep this source http://11805203.blog.51cto.com/11795203/1828879
MySQL Install for Linux