[iyunv@centos-server ~]$ yum install mysql-server
[iyunv@centos-server ~]$ chkconfig mysqld on
[iyunv@centos-server ~]$ service mysqld start
2. 配置MySQL。MySQL提供了一个名为mysql_secure_installation的工具,协助我们在安装完毕后做一些必要的安全设置。
[iyunv@centos-server ~]$ mysql_secure_installation ... ... In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ###输入当前的root密码, 默认为空 OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] ###是否需要重设root密码? New password: Re-enter new password: Password updated successfully!Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ###是否移除匿名用户? ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ###是否禁用root远程连接? ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] n ###是否删除test数据库? n ... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ###重新载入授权信息? ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
3. 检查MySQL是否正常运行。
[iyunv@centos-server ~]$ mysqladmin -h localhost -u root -p version Enter password: mysqladmin Ver 8.42 Distrib 5.1.61, for redhat-linux-gnu on x86_64 Copyright (c) 2000, 2011, 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. Server version 5.1.61 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 16 min 14 sec Threads: 1 Questions: 21 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.21
[iyunv@centos-server ~]$ yum search php cups-php.x86_64 : Common Unix Printing System - php module graphviz-php.x86_64 : PHP extension for graphviz php.x86_64 : PHP scripting language for creating dynamic web sites php-bcmath.x86_64 : A module for PHP applications for using the bcmath library php-cli.x86_64 : Command-line interface for PHP php-common.x86_64 : Common files for PHP php-dba.x86_64 : A database abstraction layer module for PHP applications php-devel.x86_64 : Files needed for building PHP extensions php-embedded.x86_64 : PHP library for embedding in applications php-gd.x86_64 : A module for PHP applications forusing the gd graphics library php-imap.x86_64 : A module for PHP applications that use IMAP php-intl.x86_64 : Internationalization extension for PHP applications php-ldap.x86_64 : A module for PHP applications that use LDAP php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling php-mysql.x86_64 : A module for PHP applications that use MySQL databases php-odbc.x86_64 : A module for PHP applications that use ODBC databases php-pdo.x86_64 : A database access abstraction module for PHP applications php-pear.noarch : PHP Extension and Application Repository framework php-pecl-apc.x86_64 : APC caches and optimizes PHP intermediate code php-pgsql.x86_64 : A PostgreSQL database module for PHP php-process.x86_64 : Modules for PHP script using system process interfaces php-pspell.x86_64 : A module for PHP applications for using pspell interfaces php-recode.x86_64 : A module for PHP applications for using the recode library php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices php-soap.x86_64 : A module for PHP applications that use the SOAP protocol php-tidy.x86_64 : Standard PHP module provides tidy library support php-xml.x86_64 : A module for PHP applications which use XML php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol php-zts.x86_64 : Thread-safe PHP interpreter for use with the Apache HTTP Server rrdtool-php.x86_64 : PHP RRDtool bindings uuid-php.x86_64 : PHP supportfor Universally Unique Identifier library php-enchant.x86_64 : Human Language and Character Encoding Support php-pecl-apc-devel.x86_64 : APC developer files (header) php-pecl-memcache.x86_64 : Extension to work with the Memcached caching daemon