CentOS6下安裝MySQL資料庫服務

來源:互聯網
上載者:User

標籤:資料庫服務   mysql   centos6   

    大家好,今天是我在51CTO上的第一篇博文,以此來督促我自個養成一個好的學習習慣,也希望給大家有所協助。

    ok,言歸正傳,今天我介紹的是在CentOS6環境下安裝MySQL資料庫,我所用到的是CentOS6鏡像檔案中所帶的mysql包。

    1、配置本地yum源。 

[[email protected] ~]# cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# ls

CentOS-Base.repo.bak  CentOS-Debuginfo.repo.bak  CentOS-fasttrack.repo.bak  CentOS-Media.repo  CentOS-Vault.repo.bak

修改如下:

[[email protected] yum.repos.d]# vim CentOS-Media.repo

baseurl=file:///mnt      */mnt為掛載點*

enabled=1                *開啟狀態*

    2、安裝mysql。

[[email protected] ~]# yum list | grep mysql     *查詢與mysql有關的包*

[[email protected] ~]# yum install -y mysql-server.x86_64 mysql.x86_64 mysql-devel.x86_64 *安裝mysql包和開發所用到的包*

[[email protected] ~]# service mysqld start      *初始化mysql資料庫*

[[email protected] ~]# service mysqld restart    *重啟mysql服務*

[[email protected] ~]# mysqladmin -u root password ‘123456‘    *組態管理mysql的使用者的密碼*

[[email protected] ~]# mysql -u root -p    

Enter password:                                 *登入mysql,輸入管理密碼*

出現如下,表示登入成功:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 5.1.73 Source distribution


Copyright (c) 2000, 2013, 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> 

相關命令: show databases;    *查看目前有的資料庫*

           create database ming; *建立名字為ming的資料庫*

     3、mysql的設定檔。

[[email protected] ~]# cd /etc/

[[email protected] etc]# ls my.cnf 

my.cnf

     4、mysql資料庫的庫所在位置。

[[email protected] ~]# cd /var/lib/mysql/

[[email protected] mysql]# ls

ibdata1  ib_logfile0  ib_logfile1  ming  mingming  mysql  mysql.sock  test

     5、mysql資料庫的記錄檔所在位置。

[[email protected] ~]# cd /var/log/

[[email protected] log]# ls

anaconda.ifcfg.log    btmp           dmesg             maillog-20150802   prelink          spooler-20150714

anaconda.log          btmp-20150802  dmesg.old         mcelog             sa               spooler-20150719

anaconda.program.log  ConsoleKit     dracut.log        messages           samba            spooler-20150730

anaconda.storage.log  cron           httpd             messages-20150714  secure           spooler-20150802

anaconda.syslog       cron-20150714  lastlog           messages-20150719  secure-20150714  sssd

anaconda.xlog         cron-20150719  maillog           messages-20150730  secure-20150719  tallylog

anaconda.yum.log      cron-20150730  maillog-20150714  messages-20150802  secure-20150730  wtmp

audit                 cron-20150802  maillog-20150719  mysqld.log         secure-20150802  yum.log

boot.log              cups           maillog-20150730  ntpstats           spooler

[[email protected] log]# cat mysqld.log 

Version: ‘5.1.73‘  socket: ‘/var/lib/mysql/mysql.sock‘  port: 3306  Source distribution

*mysql服務是TCP,連接埠號碼為3306*

    6、監聽mysql服務。

[[email protected] ~]# netstat -tlun 

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN 


         ******此文結束*******               

                 2015-8-3




本文出自 “努力!奮鬥!” 部落格,請務必保留此出處http://026mingming.blog.51cto.com/8783374/1681434

CentOS6下安裝MySQL資料庫服務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.