Install MySQL 6.5 in Centos 5.6

Source: Internet
Author: User

Install MySQL 6.5 in Centos 5.6
1. Download the RPM package corresponding to Linux

Http://dev.mysql.com/downloads/mysql/5.6.html

wget http://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-5.6.33-1.el6.x86_64.rpm-bundle.tar
  • 1
  • 1
2. decompress the tar package
tar -xvf MySQL-5.6.33-1.el6.x86_64.rpm-bundle.tar
  • 1
  • 1
3. Install MySQL
rpm -ivh MySQL-server-5.6.33-1.el6.x86_64.rpm rpm -ivh MySQL-client-5.6.33-1.el6.x86_64.rpm rpm -ivh MySQL-devel-5.6.33-1.el6.x86_64.rpm
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

If:

error: Failed dependencies:        libaio.so.1()(64bit) is needed by MySQL-server-5.6.33-1.el6.x86_64        libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.33-1.el6.x86_64        libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.33-1.el6.x86_64
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

Download libaio

yum install libaio
  • 1
  • 1

If:

error: Failed dependencies:        libnuma.so.1()(64bit) is needed by MySQL-server-5.6.33-1.el6.x86_64        libnuma.so.1(libnuma_1.1)(64bit) is needed by MySQL-server-5.6.33-1.el6.x86_64        libnuma.so.1(libnuma_1.2)(64bit) is needed by MySQL-server-5.6.33-1.el6.x86_64
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

Download numactl

yum install numactl
  • 1
  • 1
4. initialize MySQL and set the password
/usr/bin/mysql_install_dbservice mysql start
  • 1
  • 2
  • 1
  • 2

If the startup fails, the directory where the data block is located does not have the permission.

Cat/root/. mysql_secret # view the root account PASSWORD mysql> set password = PASSWORD ('20140901'); mysql> exit
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

If the. mysql_secret file does not exist, stop MySQL and set the password in safe mode.

service mysql stopmysqld_safe --skip-grant-tables&mysql -u root mysqlmysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';mysql> FLUSH PRIVILEGES;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5
5. Allow Remote Login
mysql> use mysql;mysql> select host,user,password from user;mysql> update user set host='%' where user='root' and host='localhost';mysql> flush privileges;mysql> exit
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5
6. Set auto-start upon startup
chkconfig mysql onchkconfig --list | grep mysqlmysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
7. default installation location of MySQL
/Var/lib/mysql/# Database directory/usr/share/mysql # configuration file directory/usr/bin # related command directory/etc/init. d/mysql # Start script
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
8. Common commands

1. Use a client tool to connect to the database

mysql -u root -p
  • 1
  • 1

2. view the databases contained in the MySQL server

mysql>SHOW DATABASES;
  • 1
  • 1

3. View data table information in the database

mysql>SHOW TABLES;
  • 1
  • 1

4. Switch Database

mysql>USE mysql;
  • 1
  • 1

5. Create a new database

Mysql> create database name;
  • 1
  • 1

6. Create a new data table

Mysql> create table Name (field definition)
  • 1
  • 1

7. delete a data table

Mysql> drop table database name. TABLE Name;
  • 1
  • 1

8. delete a database

Mysql> drop database Name
  • 1
  • 1

9. Back up the entire database

mysqldump -u root -p auth > mysql-auth.sql
  • 1
  • 1

10. Back up the user table in MYSQL.

mysqldump -u root -p mysql user > mysql.host-user.sql
  • 1
  • 1

11. Back up all databases on the MYSQL server

mysqldump -u root -p -all-databases > mysql-all.sql
  • 1
  • 1

12. Restore the database

Mysql-u root-p [database name] <mysql-all. SQL
  • 1
  • 1

13. Grant User Permissions

GRANT permission list ON database name. Table name TO user name @ Source Address [identified by 'Password'] grant select on mysql. user TO daxiong @ 'localhost' identified by '123 ';

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.