This article is based on CentOS 64-bit
1. Download MySQL first (mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz)
Download http://dev.mysql.com/downloads/from official website
Select the appropriate Linux version
2. Copy the mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz to the/usr/lib/mysql/directory, if there is no folder, create the folder, command:
mkdir MySQL
sudo tar xvf mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz //Unzip files
3.copy
CP Mysql-5.6.27-linux-glibc2.5-i686/usr/local/mysql-r
4. Add a user group
Add system MySQL Group and MySQL User:
Execute command: Groupadd MySQL and Useradd-r-G MySQL MySQL
5.
To Install the database:
Go to install MySQL software directory: Execute command cd/usr/local/mysql
Modify current directory owner for MySQL User: Execute command chown-r mysql:mysql.
Install database: Executes the command./scripts/mysql_install_db--user=mysql
Modify the current directory owner as root User: Execute command chown-r root:root.
Modify the current data directory owner for MySQL User: Execute command chown-r mysql:mysql data
to this database installation is complete
6. Start the MySQL service and add the boot MySQL service:
Add Boot: Execute command CP Support-files/mysql.server/etc/init.d/mysql, put startup script into boot initialization directory
Start MySQL service: Execute command service MySQL start
Execute command: ps-ef|grep mysql see MySQL service description started successfully
7.
To modify the root user password of MySQL, the root initial password is empty:
Execute command:./bin/mysqladmin-u root password ' password '
8.
Put the MySQL client on the default path:
ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql
9. Modify the default connection
mysql-uroot-p//Connection Database
Use MySQL;
SELECT * from user WHERE host= ' localhost ' and user= ' root ';//should return a piece of data
UPDATE user SET host= '% ' WHERE host= ' localhost ' and user= ' root ';
attached: Problems that may be encountered during installation
1.Mysql Chinese garbled
sudo nano/etc/mysql/my.cnf. (5.5 previous system) added Default-character-set=utf8 under "Client"
Add Character_set_server=utf8 under "mysqld" to resolve.
2.Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
Cannot connect to the server through '/tmp/mysql. Sock ', some MySQL installation methods will be MySQL. Sock in/var/lib/mysql. Sock or somewhere else, you can modify the/etc/ MY.CNF file to fix it, open the file, you can see the following things:
[Mysqld]
Socket=/var/lib/mysql.sock
Change it, but it will also cause other problems, such as the MySQL program is not connected, add a bit:
[MySQL]
Socket=/tmp/mysql.sock
Or in such a way:
ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
Install MySQL under Linux