MySQL has 2 different places from windows
1, My.ini Save to/etc/my.ini
2, user rights, individual user execution
One: Download: direct command download.
wget Http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar
Second, the establishment of users, as well as the MySQL directory
1, Groupadd MySQL #建立一个mysql的组
2, Useradd-r-g MySQL MySQL #建立mysql用户, and put the user into the MySQL group
3, passwd MySQL #给mysql用户设置一个密码
Third, decompression MySQL
1. Move the tar package to the/usr/local directory
Mv/software/mysql-5.7.17-linux-glibc2.5-x86_64.tar/usr/local
2. Decompression
Cd/usr/local
Tar zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
Note: There is no data directory, My.ini in the Support-files directory
3. Change the directory name to/usr/local/mysql (the default installation directory for MySQL under Linux)
MV Mysql-5.7.17-linux-glibc2.5-x86_64 MySQL
Iv. configuration-related boot configuration files
1. Copy my.cnf to/ETC/MY.CNF (automatically read at mysqld startup)
CP MY-DEFAULT.CNF/ETC/MY.CNF
2, solve the garbled problem
Vi/etc/my.cnf
[MySQL]
Default-character-set=utf8
[Mysqld]
Default-storage-engine=innodb
Character_set_server=utf8
3, copy Mysql.server to/etc/init.d/directory "purpose to achieve mysqld-install such boot automatic execution effect"
CP Mysql.server/etc/init.d/mysql (MySQL is the service name)
4. Modify/etc/init.d/mysql Parameters
Vi/etc/init.d/mysql
Given with 2 directory locations
Basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
4, to the directory/usr/local/mysql change owner "R" for recursion, that is, all the folders are changed to consistent "
Chown-r mysql:mysql/usr/local/mysql/
V. Initialize the MySQL database
mysql_install_db (old version of the procedure)
New version:
1. Initialization
./mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
Generate a data directory that represents the successful initialization of the database
and the root user of MySQL generates a temporary password: A&Y7,+,CWJD. "It's different every time."
2. Encrypt the database
./mysql_ssl_rsa_setup--datadir=/usr/local/mysql/data
3. Start MySQL
./mysqld_safe--user=mysql &
& indicates that the thread is started in the background
"Check Ps-ef|grep MySQL"
Vi. Enter the client "go to the directory in the bin of MySQL"
1. Login./mysql-uroot-p
The password is a temporary password that is generated. At this point, you have entered MySQL.
2. Change the password
Set Password=password (' 123456 ');
Vii. Remote Access
1. Shut down the firewall or open the port to the firewall
Systemctl Stop Firewalld.service
2. Authorization
Mysql>grant all privileges on * * to [e-mail protected] '% ' identified by ' 123456 ';
Go to MySQL database:
Use MySQL;
Mysql>select host,user from user; "1 more Telnet user records"
Mysql>flush privileges;
Eight, set the boot automatically start
1. Add service MySQL
Chkconfig--add MySQL "Mysqld-install"
2. Set up MySQL service for automatic
Chkconfig MySQL on
3. Restart Check
Init 6
Ps-ef|grep MySQL
Nine, set the path to set the global
Vi/etc/profile
Export path= $JAVA _home/bin:/usr/local/mysql/bin: $PATH
Linux configuration MySQL