cent os 搭建博客

第一步,用centos安装好mysql.
用yum方法实现。

yum list | grep mysql
mysql安装

然后我们可以通过输入

yum install -y mysql-server mysql mysql-devel

命令将mysql mysql-server mysql-devel都安装好(注意:安装mysql时我们并不是安装了mysql客户端就相当于安装好了mysql数据库了,我们还需要安装mysql-server服务端才行)

Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: muug.ca
 * extras: muug.ca
 * updates: muug.ca
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-7.el6 will be installed
--> Processing Dependency: mysql-libs = 5.1.73-7.el6 for package: mysql-5.1.73-7.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: mysql-5.1.73-7.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: mysql-5.1.73-7.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-5.1.73-7.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-5.1.73-7.el6.x86_64
---> Package mysql-devel.x86_64 0:5.1.73-7.el6 will be installed
--> Processing Dependency: openssl-devel for package: mysql-devel-5.1.73-7.el6.x86_64
---> Package mysql-server.x86_64 0:5.1.73-7.el6 will be installed
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-7.el6.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-7.el6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-7.el6.x86_64
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.73-7.el6 will be installed
---> Package openssl-devel.x86_64 0:1.0.1e-48.el6_8.3 will be installed
--> Processing Dependency: openssl = 1.0.1e-48.el6_8.3 for package: openssl-devel-1.0.1e-48.el6_8.3.x86_64
--> Processing Dependency: zlib-devel for package: openssl-devel-1.0.1e-48.el6_8.3.x86_64
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.1e-48.el6_8.3.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.10.3-57.el6 will be installed
--> Processing Dependency: krb5-libs = 1.10.3-57.el6 for package: krb5-devel-1.10.3-57.el6.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.10.3-57.el6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.10.3-57.el6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.10.3-57.el6.x86_64
---> Package openssl.x86_64 0:1.0.1e-30.el6_6.4 will be updated
---> Package openssl.x86_64 0:1.0.1e-48.el6_8.3 will be an update
---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.4-5.el6 will be installed
---> Package krb5-libs.x86_64 0:1.10.3-33.el6 will be updated
---> Package krb5-libs.x86_64 0:1.10.3-57.el6 will be an update
---> Package libcom_err-devel.x86_64 0:1.41.12-22.el6 will be installed
--> Processing Dependency: libcom_err = 1.41.12-22.el6 for package: libcom_err-devel-1.41.12-22.el6.x86_64
---> Package libselinux-devel.x86_64 0:2.0.94-7.el6 will be installed
--> Processing Dependency: libselinux = 2.0.94-7.el6 for package: libselinux-devel-2.0.94-7.el6.x86_64
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-7.el6.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-7.el6.x86_64
--> Running transaction check
---> Package libcom_err.i686 0:1.41.12-21.el6 will be updated
--> Processing Dependency: libcom_err = 1.41.12-21.el6 for package: e2fsprogs-1.41.12-21.el6.x86_64
--> Processing Dependency: libcom_err = 1.41.12-21.el6 for package: e2fsprogs-libs-1.41.12-21.el6.x86_64
--> Processing Dependency: libcom_err = 1.41.12-21.el6 for package: e2fsprogs-libs-1.41.12-21.el6.i686
--> Processing Dependency: libcom_err = 1.41.12-21.el6 for package: libss-1.41.12-21.el6.x86_64
---> Package libcom_err.x86_64 0:1.41.12-21.el6 will be updated
---> Package libcom_err.i686 0:1.41.12-22.el6 will be an update
---> Package libcom_err.x86_64 0:1.41.12-22.el6 will be an update
---> Package libselinux.i686 0:2.0.94-5.8.el6 will be updated
--> Processing Dependency: libselinux = 2.0.94-5.8.el6 for package: libselinux-utils-2.0.94-5.8.el6.x86_64
---> Package libselinux.x86_64 0:2.0.94-5.8.el6 will be updated
---> Package libselinux.i686 0:2.0.94-7.el6 will be an update
---> Package libselinux.x86_64 0:2.0.94-7.el6 will be an update
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
--> Running transaction check
---> Package e2fsprogs.x86_64 0:1.41.12-21.el6 will be updated
---> Package e2fsprogs.x86_64 0:1.41.12-22.el6 will be an update
---> Package e2fsprogs-libs.i686 0:1.41.12-21.el6 will be updated
---> Package e2fsprogs-libs.x86_64 0:1.41.12-21.el6 will be updated
---> Package e2fsprogs-libs.i686 0:1.41.12-22.el6 will be an update
---> Package e2fsprogs-libs.x86_64 0:1.41.12-22.el6 will be an update
---> Package libselinux-utils.x86_64 0:2.0.94-5.8.el6 will be updated
---> Package libselinux-utils.x86_64 0:2.0.94-7.el6 will be an update
---> Package libss.x86_64 0:1.41.12-21.el6 will be updated
---> Package libss.x86_64 0:1.41.12-22.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                  Arch        Version                Repository    Size
================================================================================
Installing:
 mysql                    x86_64      5.1.73-7.el6           base         894 k
 mysql-devel              x86_64      5.1.73-7.el6           base         130 k
 mysql-server             x86_64      5.1.73-7.el6           base         8.6 M
Installing for dependencies:
 keyutils-libs-devel      x86_64      1.4-5.el6              base          29 k
 krb5-devel               x86_64      1.10.3-57.el6          base         504 k
 libcom_err-devel         x86_64      1.41.12-22.el6         base          33 k
 libselinux-devel         x86_64      2.0.94-7.el6           base         137 k
 libsepol-devel           x86_64      2.0.41-4.el6           base          64 k
 mysql-libs               x86_64      5.1.73-7.el6           base         1.2 M
 openssl-devel            x86_64      1.0.1e-48.el6_8.3      updates      1.2 M
 perl-DBD-MySQL           x86_64      4.013-3.el6            base         134 k
 perl-DBI                 x86_64      1.609-4.el6            base         705 k
 zlib-devel               x86_64      1.2.3-29.el6           base          44 k
Updating for dependencies:
 e2fsprogs                x86_64      1.41.12-22.el6         base         554 k
 e2fsprogs-libs           i686        1.41.12-22.el6         base         128 k
 e2fsprogs-libs           x86_64      1.41.12-22.el6         base         121 k
 krb5-libs                x86_64      1.10.3-57.el6          base         770 k
 libcom_err               i686        1.41.12-22.el6         base          37 k
 libcom_err               x86_64      1.41.12-22.el6         base          37 k
 libselinux               i686        2.0.94-7.el6           base         109 k
 libselinux               x86_64      2.0.94-7.el6           base         109 k
 libselinux-utils         x86_64      2.0.94-7.el6           base          82 k
 libss                    x86_64      1.41.12-22.el6         base          42 k
 openssl                  x86_64      1.0.1e-48.el6_8.3      updates      1.5 M

Transaction Summary
================================================================================
Install      13 Package(s)
Upgrade      11 Package(s)

Total download size: 17 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           3.3 MB/s |  17 MB     00:05     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction

  Updating   : libcom_err-1.41.12-22.el6.x86_64                            1/35 

  Updating   : libselinux-2.0.94-7.el6.x86_64                              2/35 

  Updating   : krb5-libs-1.10.3-57.el6.x86_64                              3/35 

  Updating   : openssl-1.0.1e-48.el6_8.3.x86_64                            4/35 

  Installing : mysql-libs-5.1.73-7.el6.x86_64                              5/35 

  Installing : mysql-5.1.73-7.el6.x86_64                                   6/35 

  Installing : perl-DBI-1.609-4.el6.x86_64                                 7/35 

  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                           8/35 

  Updating   : libss-1.41.12-22.el6.x86_64                                 9/35 

  Installing : libcom_err-devel-1.41.12-22.el6.x86_64                     10/35 

  Updating   : e2fsprogs-libs-1.41.12-22.el6.x86_64                       11/35 

  Installing : libsepol-devel-2.0.41-4.el6.x86_64                         12/35 

  Installing : libselinux-devel-2.0.94-7.el6.x86_64                       13/35 

  Installing : zlib-devel-1.2.3-29.el6.x86_64                             14/35 

  Installing : keyutils-libs-devel-1.4-5.el6.x86_64                       15/35 

  Installing : krb5-devel-1.10.3-57.el6.x86_64                            16/35 

  Installing : openssl-devel-1.0.1e-48.el6_8.3.x86_64                     17/35 

  Updating   : libcom_err-1.41.12-22.el6.i686                             18/35 

  Installing : mysql-devel-5.1.73-7.el6.x86_64                            19/35 

  Updating   : e2fsprogs-1.41.12-22.el6.x86_64                            20/35 

  Installing : mysql-server-5.1.73-7.el6.x86_64                           21/35 

  Updating   : libselinux-utils-2.0.94-7.el6.x86_64                       22/35 

  Updating   : e2fsprogs-libs-1.41.12-22.el6.i686                         23/35 

  Updating   : libselinux-2.0.94-7.el6.i686                               24/35 

  Cleanup    : e2fsprogs-libs-1.41.12-21.el6                              25/35 

  Cleanup    : libcom_err-1.41.12-21.el6                                  26/35 

  Cleanup    : libselinux-2.0.94-5.8.el6                                  27/35 

  Cleanup    : e2fsprogs-1.41.12-21.el6.x86_64                            28/35 

  Cleanup    : openssl-1.0.1e-30.el6_6.4.x86_64                           29/35 

  Cleanup    : krb5-libs-1.10.3-33.el6.x86_64                             30/35 

  Cleanup    : e2fsprogs-libs-1.41.12-21.el6                              31/35 

  Cleanup    : libss-1.41.12-21.el6.x86_64                                32/35 

  Cleanup    : libselinux-utils-2.0.94-5.8.el6.x86_64                     33/35 

  Cleanup    : libselinux-2.0.94-5.8.el6                                  34/35 

  Cleanup    : libcom_err-1.41.12-21.el6                                  35/35 

  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                           1/35 

  Verifying  : perl-DBI-1.609-4.el6.x86_64                                 2/35 

  Verifying  : libselinux-2.0.94-7.el6.i686                                3/35 

  Verifying  : mysql-5.1.73-7.el6.x86_64                                   4/35 

  Verifying  : keyutils-libs-devel-1.4-5.el6.x86_64                        5/35 

  Verifying  : libss-1.41.12-22.el6.x86_64                                 6/35 

  Verifying  : zlib-devel-1.2.3-29.el6.x86_64                              7/35 

  Verifying  : krb5-devel-1.10.3-57.el6.x86_64                             8/35 

  Verifying  : mysql-libs-5.1.73-7.el6.x86_64                              9/35 

  Verifying  : libcom_err-devel-1.41.12-22.el6.x86_64                     10/35 

  Verifying  : openssl-1.0.1e-48.el6_8.3.x86_64                           11/35 

  Verifying  : e2fsprogs-libs-1.41.12-22.el6.i686                         12/35 

  Verifying  : e2fsprogs-1.41.12-22.el6.x86_64                            13/35 

  Verifying  : libcom_err-1.41.12-22.el6.i686                             14/35 

  Verifying  : libsepol-devel-2.0.41-4.el6.x86_64                         15/35 

  Verifying  : libselinux-utils-2.0.94-7.el6.x86_64                       16/35 

  Verifying  : openssl-devel-1.0.1e-48.el6_8.3.x86_64                     17/35 

  Verifying  : mysql-server-5.1.73-7.el6.x86_64                           18/35 

  Verifying  : libselinux-2.0.94-7.el6.x86_64                             19/35 

  Verifying  : libcom_err-1.41.12-22.el6.x86_64                           20/35 

  Verifying  : libselinux-devel-2.0.94-7.el6.x86_64                       21/35 

  Verifying  : mysql-devel-5.1.73-7.el6.x86_64                            22/35 

  Verifying  : krb5-libs-1.10.3-57.el6.x86_64                             23/35 

  Verifying  : e2fsprogs-libs-1.41.12-22.el6.x86_64                       24/35 

  Verifying  : e2fsprogs-1.41.12-21.el6.x86_64                            25/35 

  Verifying  : e2fsprogs-libs-1.41.12-21.el6.i686                         26/35 

  Verifying  : libcom_err-1.41.12-21.el6.x86_64                           27/35 

  Verifying  : libselinux-utils-2.0.94-5.8.el6.x86_64                     28/35 

  Verifying  : libselinux-2.0.94-5.8.el6.i686                             29/35 

  Verifying  : openssl-1.0.1e-30.el6_6.4.x86_64                           30/35 

  Verifying  : e2fsprogs-libs-1.41.12-21.el6.x86_64                       31/35 

  Verifying  : libss-1.41.12-21.el6.x86_64                                32/35 

  Verifying  : libselinux-2.0.94-5.8.el6.x86_64                           33/35 

  Verifying  : libcom_err-1.41.12-21.el6.i686                             34/35 

  Verifying  : krb5-libs-1.10.3-33.el6.x86_64                             35/35 

Installed:
  mysql.x86_64 0:5.1.73-7.el6             mysql-devel.x86_64 0:5.1.73-7.el6     
  mysql-server.x86_64 0:5.1.73-7.el6     

Dependency Installed:
  keyutils-libs-devel.x86_64 0:1.4-5.el6                                        
  krb5-devel.x86_64 0:1.10.3-57.el6                                             
  libcom_err-devel.x86_64 0:1.41.12-22.el6                                      
  libselinux-devel.x86_64 0:2.0.94-7.el6                                        
  libsepol-devel.x86_64 0:2.0.41-4.el6                                          
  mysql-libs.x86_64 0:5.1.73-7.el6                                              
  openssl-devel.x86_64 0:1.0.1e-48.el6_8.3                                      
  perl-DBD-MySQL.x86_64 0:4.013-3.el6                                           
  perl-DBI.x86_64 0:1.609-4.el6                                                 
  zlib-devel.x86_64 0:1.2.3-29.el6                                              

Dependency Updated:
  e2fsprogs.x86_64 0:1.41.12-22.el6       e2fsprogs-libs.i686 0:1.41.12-22.el6 
  e2fsprogs-libs.x86_64 0:1.41.12-22.el6  krb5-libs.x86_64 0:1.10.3-57.el6     
  libcom_err.i686 0:1.41.12-22.el6        libcom_err.x86_64 0:1.41.12-22.el6   
  libselinux.i686 0:2.0.94-7.el6          libselinux.x86_64 0:2.0.94-7.el6     
  libselinux-utils.x86_64 0:2.0.94-7.el6  libss.x86_64 0:1.41.12-22.el6        
  openssl.x86_64 0:1.0.1e-48.el6_8.3     

Complete!

我们发现,通过yum方式安装mysql数据库省去了很多没必要的麻烦,当出现下面的结果时,就代表mysql数据库安装成功了

通过以下命令来判断我的mysql是否已经安装成功

rpm -qi mysql-server

启动mysql服务可以用以下命令

service mysqld start

会显示以下信息

[root /]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[  OK  ]
Starting mysqld:  [  OK  ]

重新启动mysqld

service mysqld restart

之后就是这些信息:

[root /]# service mysqld restart
Stopping mysqld:  [  OK  ]
Starting mysqld:  [  OK  ]

我们在使用mysql数据库时,都得首先启动mysqld服务,我们可以 通过 chkconfig --list | grep mysqld命令来查看mysql服务是不是开机自动启动,如:

[root /]# chkconfig --list | grep mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off

开机自启动

chkconfig mysqld on

检查以下

chkconfig --list | grep mysql
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

第二步

http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,047评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,807评论 3 386
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 158,501评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,839评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,951评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,117评论 1 291
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,188评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,929评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,372评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,679评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,837评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,536评论 4 335
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,168评论 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,886评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,129评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,665评论 2 362
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,739评论 2 351

推荐阅读更多精彩内容