LNMP环境搭建之二--mysql

来源:互联网 发布:淘宝朋友代付款 编辑:程序博客网 时间:2024/05/29 16:28

安装 MySQL

[root@VM_88_143_centos ~]# yum install mysql-server -yLoaded plugins: fastestmirror, securitySetting up Install ProcessLoading mirror speeds from cached hostfileResolving Dependencies--> Running transaction check---> Package mysql-server.x86_64 0:5.1.73-8.el6_8 will be installed--> Processing Dependency: mysql = 5.1.73-8.el6_8 for package: mysql-server-5.1.73-8.el6_8.x86_64--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-8.el6_8.x86_64--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-8.el6_8.x86_64--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-8.el6_8.x86_64--> Running transaction check---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be installed--> Processing Dependency: mysql-libs = 5.1.73-8.el6_8 for package: mysql-5.1.73-8.el6_8.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 mysql-libs.x86_64 0:5.1.73-7.el6 will be updated---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be an update--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================= Package                                           Arch                                      Version                                             Repository                             Size=============================================================================================================================================================================================Installing: mysql-server                                      x86_64                                    5.1.73-8.el6_8                                      os                                    8.6 MInstalling for dependencies: mysql                                             x86_64                                    5.1.73-8.el6_8                                      os                                    895 k perl-DBD-MySQL                                    x86_64                                    4.013-3.el6                                         os                                    134 k perl-DBI                                          x86_64                                    1.609-4.el6                                         os                                    705 kUpdating for dependencies: mysql-libs                                        x86_64                                    5.1.73-8.el6_8                                      os                                    1.2 MTransaction Summary=============================================================================================================================================================================================Install       4 Package(s)Upgrade       1 Package(s)Total download size: 12 MDownloading Packages:(1/5): mysql-5.1.73-8.el6_8.x86_64.rpm                                                                                                                                | 895 kB     00:00     (2/5): mysql-libs-5.1.73-8.el6_8.x86_64.rpm                                                                                                                           | 1.2 MB     00:00     (3/5): mysql-server-5.1.73-8.el6_8.x86_64.rpm                                                                                                                         | 8.6 MB     00:00     (4/5): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm                                                                                                                          | 134 kB     00:00     (5/5): perl-DBI-1.609-4.el6.x86_64.rpm                                                                                                                                | 705 kB     00:00     ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                         29 MB/s |  12 MB     00:00     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Updating   : mysql-libs-5.1.73-8.el6_8.x86_64                                                                                                                                          1/6   Installing : perl-DBI-1.609-4.el6.x86_64                                                                                                                                               2/6   Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                                                                         3/6   Installing : mysql-5.1.73-8.el6_8.x86_64                                                                                                                                               4/6   Installing : mysql-server-5.1.73-8.el6_8.x86_64                                                                                                                                        5/6   Cleanup    : mysql-libs-5.1.73-7.el6.x86_64                                                                                                                                            6/6   Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                                                                         1/6   Verifying  : mysql-server-5.1.73-8.el6_8.x86_64                                                                                                                                        2/6   Verifying  : perl-DBI-1.609-4.el6.x86_64                                                                                                                                               3/6   Verifying  : mysql-5.1.73-8.el6_8.x86_64                                                                                                                                               4/6   Verifying  : mysql-libs-5.1.73-8.el6_8.x86_64                                                                                                                                          5/6   Verifying  : mysql-libs-5.1.73-7.el6.x86_64                                                                                                                                            6/6 Installed:  mysql-server.x86_64 0:5.1.73-8.el6_8                                                                                                                                                       Dependency Installed:  mysql.x86_64 0:5.1.73-8.el6_8                               perl-DBD-MySQL.x86_64 0:4.013-3.el6                               perl-DBI.x86_64 0:1.609-4.el6                              Dependency Updated:  mysql-libs.x86_64 0:5.1.73-8.el6_8                                                                                                                                                         Complete!

安装完成后,启动 MySQL 服务:

[root@VM_88_143_centos ~]# service mysqld restartStopping mysqld:                                           [  OK  ]Initializing MySQL database:  Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE 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 VM_88_143_centos password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly 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.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script!                                                           [  OK  ]Starting mysqld:                                           [  OK  ]

设置 MySQL 账户 root 密码:

[root@VM_88_143_centos ~]# /usr/bin/mysqladmin -u root password 'MyPas$word4Word_Press'

将 MySQL 设置为开机自动启动:

[root@VM_88_143_centos ~]# chkconfig mysqld on[root@VM_88_143_centos ~]# ps -ef | grep mysqlroot      3092     1  0 21:02 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysqlmysql     3194  3092  0 21:02 pts/0    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sockroot      3281  2318  0 21:03 pts/0    00:00:00 grep mysql


原创粉丝点击