mariadb的安装
yum -y install mariadb-server.x86_64
systemctl start mariadb //启动mariadb服务 MySQL的安装
yum -y install mysql-server
service mysqld start mariadb配置文件:/etc/my.cnf,/etc/my.cnf.d/*.cnf
修改/etc/my.cnf文件
加入以下值
innodb_file_per_table = ON //生成数据库列表
skip_name_resolve = ON //禁止反解 安装完成后,运行一次mysql_secure_installation,对mariadb进行配置。
[root@chunlanyy ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
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): //初次运行直接回车
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用户密码,输入y并回车
New password: //设置root用户的密码
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] //是否删除test数据库,删除
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
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! 进入mysql进行配置
相关格式:
mysql>GRANT ALL ON db_name.tbl_name To username@'host'IDENTIFIED BY "password"
GRANT ALL ON testdb.* TO 'root'@'172.16.%.%' IDENTIFIED BY "chunlanyy"; 设置用户及密码
FLUSH PRIVILEGES; //清除权限
CREATE DATABASE testab; //创建testab数据表单
三、php的安装
yum -y install php 编译安装:
四、LAMP环境测试:
因为httpd作为http协议实现的服务器,只能静态的响应和处理客户端的请求,为了使得服务器能动态的响应客户端的请求,有三种方法实现:
1)使用CGI协议:httpd服务器通过CGI协议将请求转发至程序的解释器,解释器将运行结果返回httpd服务器,随后解释器销毁
2)使用module,把php编译成httpd的扩展模块,通过httpd动态调用模块来实现
3)fastCGI:通过fpm(fastcgi process manager)让php单独运行一个类型apache的模型服务,监听某个套接字,并生成多个子进程来处理响应,而主进程只负责管理请求和控制子进程的运行状况,此时http变成fastCGI的客户端,而fastCGI变成一个简化版的http协议使php和http进行通信使用。