Centos6.5 installing MySQL

Source: Internet
Author: User

There are several ways to install the MySQL method, such as:

mysql installation method
1 yum/rpm Package installation
binary installation decompression software, simple configuration can be used without installation, faster, Professional DNA likes this way. Software name: mysql-5.5.32-linux2.6_x86_64.tar.gz
3 source compilation installation
4 source software combination yum/rpm Install

The following shows Yum and compiled installation:

One, yum installation

1. Close Iptables

[Email protected] ~]#/etc/init.d/iptables stopiptables:setting chains to Policy accept:filter [OK]iptable  s:flushing firewall rules: [OK]iptables:unloading modules: [ OK][[email protected] ~]#/etc/init.d/iptables stop[[email protected] ~]# chkconfig iptables off

2. Turn off SELinux

[Email protected] ~]# sed-i ' s/selinux=enforcing/selinux=disabled/'/etc/selinux/config[[email protected] ~]# Setenforceusage:setenforce [Enforcing | Permissive | 1 | 0][[email protected] ~]# setenforce 0[[email protected] ~]# getenforcepermissive

3. Install MySQL

[[email protected] ~]# yum -y install mysql mysql-server  mysql-develloaded plugins: fastestmirror, securitybase                                                        | 3.7 kB      00:00     base/primary_db                                            | 4.6 mb      00:30     extras                                                      | 3.4 kb     00:00     extras/primary_ db                                          |  37 kB     00:00      updates                                                    | 3.4  kB     00:00     updates/primary_db                                         | 5.2 MB      00:43 ... slightly [[email protected] ~]# chkconfig mysqld on                                     #开机启动 [[email  protected] ~]# chkconfig --list | grep mysqld# query whether to start the boot mysqld           0:off   1:off   2:on     3:on    4:on    5:on    6:off[[email  Protected] ~]# service mysqld start# Start Service starting mysqld:                                             [   ok  ]  [[email protected] ~]# mysql                                                    #进入mysqlWelcome  to the MySQL monitor.   commands end with ; or \g.your mysql connection id is  3server version: 5.1.73 source distributioncopyright  (c)  2000, 2013,  Oracle and/or its affiLiates. all rights reserved. oracle is a registered trademark of oracle corporation and/or  Itsaffiliates. other names may be trademarks of their respectiveowners . type  ' help; '  or  ' \h '  for help. Type  ' \c '  to clear the current input  statement.mysql> CREATE DATABASE wordpress; #创建一个名称为wordpress的数据库Query  ok, 1  row affected  (0.00 sec) mysql> select user,host,password from  mysql.user;                      #查询用户等信息 +------+-----------+----------+| user | host       | password |+------+-----------+----------+| root | localhost  |          | |  root | mysql     |           ||  root | 127.0.0.1 |          | |       | localhost |           | |       | mysql     |           |+------+-----------+----------+5 rows in set  (0.00 sec ) Mysql> set password for [email protected]=password (' root '); #查询用户的密码, all empty, Use the command above to set the root password to rootquery ok, 0 rows affected  (0.00 sec) mysql> select  user,host,password from mysql.user;                     #再次查询发现password下面已有密码信息 +------+-----------+------- ------------------------------------+| user | host      | password                                    |+------+-----------+----------- --------------------------------+| root | localhost | * 81f5e21e35407d884a6cd4a731aebfb6af209e1b | |  root | mysql     |                                             | |  root | 127.0.0.1 |                                             | |       | localhost |                                             | |       | mysql     |                                              |+------+-----------+-------------------------------------------+5 rows in set   (0.00 SEC) mysql> exitbye[[email protected] ~]#[[email protected] ~]#  mysql -u root -p                                      #用新密码登录Enter  password:                                                        # Fill in the password welcome to the mysql monitor.  commands end with ; or  \g.your mysql connection id is 6server version: 5.1.73 source  distribution ... Slightly mysql> exit[[email protected] ~]#[[email protected] ~]# cat /etc/my.cnf  #/ETC/MY.CNF is the main configuration file for MySQL [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql#  Disabling symbolic-links is recommended to prevent assorted security  Riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[[email  protected] ~]#[[email protected] ~]# ls -l /var/lib/mysql/# Database file storage location for MySQL database total 20492-rw-rw----.  1 mysql mysql 10485760 may 16  22:30 IBDATA1-RW-RW----.  1 mysql mysql  5242880 May 16  22:30 IB_LOGFILE0-RW-RW----.  1 mysql mysql  5242880 may 16 22:30  IB_LOGFILE1DRWX------.  2 mysql mysql     4096 may 16  22:30 mysqlsrwxrwxrwx. 1 mysql mysql         0 MAY 16 22:30 MYSQL.SOCKDRWX------.  2 mysql mysql      4096 MAY 16 22:30 TESTDRWX------. &Nbsp;2 mysql mysql     4096 may 16 22:33 wordpress[[ email protected] ~]#[[email protected] ~]# ls /var/log/# Log file storage location anaconda.ifcfg.log    anaconda.yum.log  dmesg        mysqld.log  tallyloganaconda.log           audit             dmesg.old    ntpstats    wtmpanaconda.program.log  boot.log           dracut.log  prelink      yum.loganaconda.storage.log  btmp               lastlog     saanaconda.syslog        consolekit        maillog     secureanaconda.xlog          cron              messages     spooler[[email protected] ~]#[[email protected] ~]# netstat - lntup|grep 3306# view MySQL port listening status tcp        0       0 0.0.0.0:3306                 0.0.0.0:*                    LISTEN      2053/mysqld[[email  protected] ~]#

Basic commands

show databases; To view a database that already exists on the system

Use Databasesname; Select the database you want to use

Drop database databasename; Delete the selected database

Exit//Disconnect from database

Create Database test01; To create a database named Test

Show tables; List the tables under the current database

Other basic additions and deletions using standard SQL


Open Telnet Permissions

GRANT all privileges on * * to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;

FLUSH privileges;


Reference:

Old boy

http://blog.csdn.net/xxd851116/article/details/22947891

Http://www.xxlinux.com/article/development/database/20121106/18532.html




This article is from the blog "Write to Yourself", so be sure to keep this source http://zhaodongwei.blog.51cto.com/4233742/1773898

Centos6.5 installing MySQL

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.