Baidu search MySQL, into the https://dev.mysql.com/downloads/mysql/to find their own version of the MySQL Linux compression package;
Copy out the compressed package ( Click Download First, and then copy the resource link from the download interface )
Create a MySQL directory in a suitable location on the server (personal habits/usr/local)
wget+ copy of the JDK download link, download the MySQL compressed file to the directory you created
TAR-ZXVF filename Decompression
File Rename with mv+ original filename + new file name
Add MySQL Combo MySQL account (security issue: Prevent all accounts that affect the entire system because of database account problems)
Groupadd MySQL
Useradd-r-G mysql-s/bin/false MySQL
Go to MySQL directory, modify all filegroups and accounts for MySQL in this directory
CD MySQL
Chown-r Mysql:mysql./
Installing the Database
./scripts/mysql_install_db--user=mysql
Modify all file groups and accounts in the directory except for the Root,data directory
Chown-r Root:root./
Chown-r Mysql:mysql Data
Add Boot: Execute command CP Support-files/mysql.server/etc/init.d/mysql, put startup script into boot initialization directory
Add Service
Chkconfig--add MySQL
Show List of services
Chkconfig--list
Start MySQL service: Execute command service MySQL start
The MySQL executable file is soft-chained to the execution bin
Ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql
MySQL is already installed and MySQL does not have a password by default and any user can log in (mysql-u any user name)
If login error at this time:Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2), Use the Find command to find if Mysql.sock is present and if the path is/tmp/mysql.sock
[Email protected] mysql]# Find/-name Mysql.sock
/var/lib/mysql/mysql.sock
be installed to/var/lib/mysql/mysql.sock this location, we need to modify the My.cnf file (vi/etc/my.cnf)
Restart MySQL service after saving
Remove any user login rights after logging in to MySQL
Delete from Mysql.user where user= "";
Set the root user password
Update Mysql.user set Password=passworf ("password") where user= "root";
Flush privileges;
Use password mysql-uroot-p password to re-use root login after exiting
MySQL environment setup under Linux (CentOS)