
学习一个服务的过程:
1、 此服务器的概述:名字,功能,特点,端口号
2、 安装
3、 配置文件的位置
4、 服务启劢关闭脚本,查看端口
5、 此服务的使用方式
6、 修改配置文件,实戓丼例
7、 排错(从下到上,从内到外)
本节所讲内容:
Mysql服务器常见概念
Mysql服务器安装及相关配置文件
实战:安装mysql并消除安全隐患
实战:搭建LAMP环境部署Ucenter和Ucenter-home网站
服务端:xuegod63.cn IP:192.168.1.63
客户端:xuegod64.cn IP:192.168.1.64
MySQL是一个关系型管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司。
MySQL是最流行的关系型管理系统,在WEB应用方面MySQL是最好的RDBMS(RelationalDatabase Management System:关系管理系统)应用工具之一。
MySQL是一种关联管理系统,关联将数据储存在丌同的表中,而不是将所有数据放到一个大仓库内,这样就减少了速度并增加了灵活性。
MySQL所使用的SQL语言是用于访问最常见标准化语言。MySQL软件运用了双授权政策,它分为社区版和商业版,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一种类,一般中小型网站的开发都选用MySQL作为网站。由于其社区版的性能非凡,搭配PHP和Apache可构成良好的开发环境。
双授权政策:开放源代码版本和商业版本。
例如:很多公司出售应用工具,例如Microsoft、Apple和Oracle;
如Red Hat和IBM,则借助为其开放源代码软件提供销售支援、托管戒咨询等服务来进行赚钱。但鲜为人知的是,企业可以透过开放源代码发布仕们的硬件,也可以同时销售该工具的商业版本。
Linux+Apache+Mysql+PHP
以rpm包的方法安装LAMP。
一、安装应该的软件包
[root@xuegod63 ~]#yum install httpd mysql-server mysql php php-mysql -y
httpd # web服务器
mysql-server#mysql

mysql # mysql服务器linux下客户端
php-mysql#??? #php程序连接mysql使用的组件
查看一个包的作用
查看php-mysql包作用
[root@xuegod63 Packages]# rpm -pqi php-mysql-5.3.3-3.el6_1.3.x86_64.rpmwarning: php-mysql-5.3.3-3.el6_1.3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYName : php-mysql Relocations: (not relocatable)Version : 5.3.3 Vendor: Red Hat, Inc.Release : 3.el6_1.3 Build Date: Mon 24 Oct 2011 08:41:54 PM CSTInstall Date: (not installed) Build Host: x86-004.build.bos.redhat.comGroup : Development/Languages Source RPM: php-5.3.3-3.el6_1.3.src.rpmSize : 220619 License: PHPSignature : RSA/8, Wed 02 Nov 2011 09:58:41 PM CST, Key ID 199e2f91fd431d51Packager : Red Hat, Inc. <;URL : Summary : A module for PHP applications that use MySQL databases 百度翻译一下
查看某个命令由什么包安装
[root@xuegod63 ~]#rpm -qf `which mysql `
查看apache版本:
[root@xuegod63 ~]#httpd -v
查看mysql数据版客户端版本
[root@xuegod63~]# mysql –V
启劢服务LAMP相关服务:
[root@xuegod63 ~]# service httpd restartStopping httpd: [FAILED]Starting httpd: [ OK ][root@xuegod63 ~]# chkconfig httpd on[root@xuegod63 ~]# service mysqld start[root@xuegod63 ~]# chkconfig mysqld on
测试连接:
连接mysql,连接本机可以去掉-h
# mysql -h IP -uUSER -pPASS
Mysql的超级管理员是root拥有最mysql的最高权限。
# mysql -u root
mysql>exit; #退出mysql
配置root密码
[root@xuegod64~]# /usr/bin/mysqladmin -u root password "123456"
测试:登录mysql
[root@xuegod63kaixin]# mysql -u root -p
[root@xuegod63kaixin]# mysql -u root -p123456
安装完mysql-server 会提示可以运行mysql_secure_installation。运行mysql_secure_installation会执行几个设置:
a)为root用户修改密码
b)删除匿名账号
c)取消root用户远程注册

d)删除test库和对test库的访问权限
e)刷新授权表使更改生效
通过这几项的设定才能提升mysql库的安全。建议制造环境中mysql安装这完成后一定要运行一次mysql_secure_installation,详细方法请参阅以下的命令:
NOTE: RUNNINGALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACHSTEP CAREFULLY!
In order to log into MySQL to secure it, we'llneed the current
password for the root user. If you've justinstalled MySQL, and
you haven't set the root password yet, thepassword will be blank,
so you should just press enter here.
Enter current password for root (enter fornone):<–初次运行直接回车
OK, successfully used password, moving on…
Setting the root password ensures that nobodycan log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n]<–是否修改root用户密码,刚才我已修改密码,我们输n
... skipping
By default, aMySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have auser account created for
them. This is intended only for testing, andto make the installation
go a bit smoother. You should remove them beforemoving into a
production environment.
Remove anonymous users? [Y/n]<–是否删除匿名客户,生产环境建议删除,所以直接回车或Y
… Success!
Normally, root should only be allowed toconnect from 'localhost'. This
ensures that someone cannot guess at the rootpassword from the network.
Disallow root login remotely? [Y/n]<–是否允许root远程登陆,根据自己的需求选择Y/n并回车,建议禁止
… Success!
By default, MySQL comes with a database named'test' that anyone can
access. This is also intended only fortesting, and should be removed

before moving into a production environment.
Remove test database and access to it? [Y/n]<–是否删除test,直接回车或Y
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
Reloading the privilege tables will ensurethat 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 abovesteps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[root@xuegod63 ~]# mysql -u root -p123456mysql> show databases; #没有test #执行时,所有命令以;号开头+--------------------+| Database |+--------------------+| information_schema || mysql || ucenter |+--------------------+3 rows in set (0.00 sec)mysql> exit #退出命令可以加分号,也可以不加分号。
测试网站是否支持PHP
# cd /var/www/html/[root@stu003 html]# vim index.php[root@stu003 html]# vim index.php<?phpphpinfo();?>测试:

搭建LAMP环境部署Ucenter和Ucenter-home网站,搭建一个类人人网的社交网页

UCenter用户中心,实现用户的统一登陆登出,积分的充值,TAG的互通等,在安装UCenter Home、Discuz!、SupeSite、X-Space 等应用前需要先调试UCenter。本教程详解的即是怎样全新安装UCenter 1.5.0。
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-122388-1.html
为什么呢
时间已经不站在我们这一边