Run the rpm package to teach you how to install MySQL (MySQL-server-5.6.23 for CentOS6.5 _ 64bit), centos6.5mysql

Source: Internet
Author: User

Run the rpm package to teach you how to install MySQL (MySQL-server-5.6.23 for CentOS6.5 _ 64bit), centos6.5mysql

Reprinted please indicate the source: http://blog.csdn.net/guoyjoe/article/details/44753455


1. Check whether MySQL is installed on the operating system.
[Root @ mydb1 backup] # rpm-qa | grep mysql
Qt-mysql-4.6.2-26.el6_4.x86_64
Mysql-5.1.71-1.el6.x86_64
Mysql-server-5.1.71-1.el6.x86_64
Mysql-devel-5.1.71-1.el6.x86_64
Mysql-libs-5.1.71-1.el6.x86_64


2. Delete MyQL (the mysql-libs that comes with the redhat6.3 Server is a mysql-libs-5.1.61-4.el6.x86_64 and may conflict with the mysql-libs of a later version)
Yum remove mysql-libs




Iii. Install MySQL with RPM (the root user does not need to create a mysql group or a mysql user in advance. It will be automatically created during mysql-server Installation)
[Root @ mydb1 backups] # rpm-pql MySQL-server-5.6.23-1.el6.x86_64.rpm | more
[Root @ mydb1 backup] # rpm-ivh MySQL-server-5.6.23-1.el6.i686.rpm
[Root @ mydb1 backup] # rpm-ivh MySQL-client-5.6.23-1.el6.x86_64.rpm




4. Create an installation directory
Mkdir-p/u01/app/mysql/data/mysql3306/data
Mkdir-p/u01/app/mysql/data/mysql3306/log
Mkdir-p/u01/app/mysql/log/mysql3306/iblog
Mkdir-p/u01/app/mysql/log/mysql3306/binlog
Mkdir-p/u01/app/mysql/data/mysql3306/tmp




5. Configure my. cnf
Cp/usr/my. cnf/u01/app/mysql/data/mysql3306/my. cnf


Vi/u01/app/mysql/data/mysql3306/my. cnf
[Client]
Port = 3306
Socket =/u01/app/mysql/data/mysql3306/run/mysql. sock


[Mysql]
Port = 3306
Promprt =\\ u \\ d \\ r :\\ m :\\ s>


[Mysqld]
Default-storage-engine = INNODB
Character-set-server = utf8
Explicit_defaults_for_timestamp = true


# Dir
Innodb_log_group_home_dir =/u01/app/mysql/log/mysql3306/iblog
Innodb_data_home_dir =/u01/app/mysql/log/mysql3306/iblog
Basedir =/usr
Datadir =/u01/app/mysql/data/mysql3306/data
Tmpdir =/u01/app/mysql/data/mysql3306/tmp
Slave_load_tmpdir =/u01/app/mysql/data/mysql3306/tmp
Log-error =/u01/app/mysql/data/mysql3306/log/alert. log
Slow_query_log_file =/u01/app/mysql/data/mysql3306/log/slow. log
Relay_log_info_file =/u01/app/mysql/log/mysql3306/binlog/relay-log.info
Master-info-file =/u01/app/mysql/log/mysql3306/binlog/master.info
Socket =/u01/app/mysql/data/mysql3306/run/mysql. sock
Log-bin =/u01/app/mysql/log/mysql3306/binlog
Relay-log =/u01/app/mysql/log/mysql3306/binlog/relaylog


Innodb_force_recovery = 0






4. Execute the MySQL installation script
Sh init3306.sh


Rm-rf/u01/app/mysql/mysql3306/data /*
Rm-rf/u01/app/mysql/log/mysql3306/iblog /*
Rm-rf/u01/app/mysql/log/mysql3306/binlog /*
Chmod-R 777/u01/app/mysql/data/mysql/3306/data /*
Chmod-R 777/u01/app/mysql/log/mysql3306/iblog /*
Chmod-R 777/u01/app/mysql/log/mysql3306/binlog /*
Chmod 755/u01/app/mysql/data/mysql3306/my. cnf
Mysql_install_db -- defaults-file =/u01/app/mysql/data/mysql3306/my. cnf -- basedir =/usr/-- datadir =/u01/app/mysql/data/mysql3306/data




5. Check whether the MySQL service exists. If mysql is not added to the service, start the service.
Chkconfig -- add mysqld
Chkconfig -- level 2345 mysqld on
Check whether startup setting is successful
[Root @ mydb1 ~] # Chkconfig -- list | grep mysql
Mysql 0: off 1: off 2: on 3: on 4: on 5: on 6: off


6. Start MySQL
[Root @ mydb1 ~] # Service mysql start
Starting MySQL SUCCESS!

7. How to view the MySQL running status
[Root @ mydb1 ~] # Service mysql status
SUCCESS! MySQL running (4104)
 
8. Check the initial MySQL password
[Root @ mydb1 ~] # Cat/root/. mysql_secret
# The random password set for the root user at Mon Mar 30 15:04:58 2015 (local time): B15xIBTq3xAoGRVx


9. log on to MySQL
[Root @ mydb1 ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 6
Server version: 5.6.23


Copyright (c) 2000,201 5, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.


Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.


Mysql>


10. Change the password
Mysql> show databases;
ERROR 1820 (HY000): You must set password before executing this statement
Mysql> set password = PASSWORD ('guoyjoe123 ');
Query OK, 0 rows affected (0.00 sec)


Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| Test |
+ -------------------- +
4 rows in set (0.00 sec)


To remotely access the root user, run the following command!
Mysql> grant all privileges on *. * TO 'root' @ '%' identified by 'guoyjoe123 'with grant option;

Related Article

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.