mysql 的设置
网上的一些文章都已经比较老了,现在版本高了之后,其实配置是很省力的(不考虑什么负载的话)
分享全过程,出了文中提到的安装epel rpmfushion 源指令不同外,其他的过程也适用与Centos 5
http://www.cnblogs.com/cryinstall/archive/2011/09/25/2189900.html
1.安装CentOS 6 ,可以选择最小安装,也可以安装桌面
2.升级系统
yum update
3.安装mysql,并设置mysql开机自启动,同时启动mysql
yum install mysql
yum install mysql-server
chkconfig --levels 35 mysqld on
service mysqld start
4.配置mysql的root密码
mysql_secure_installation
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] (Y)
New password: (123456)
Re-enter new password: (123456)
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]
(是否移出数据库的默认帐户,如果移出,那么在终端中直接输入mysql是会提示连接错误的)Y
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的远程登录)Y
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] Y
Reload privilege tables now? [Y/n] Y
5.安装apache,并设置开机启动
yum install httpd
chkconfig --levels 35 httpd on
service httpd start
这时候可以测试apache是否正常工作
直接浏览器访问localhost应该没问题,但是如果别的机子访问不了的话,是因为防火墙的关系,配置防火墙
(后面的ssl还会有这个问题的)
6.安装php
yum install php yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
这个时候php就安装完成拉,写个脚本测试一下
vi /var/www/html/info.php
输入
<?php phpinfo();?> |
访问localhost/info.php即可~
7.安装phpMyAdmin
首先先给系统安装epel 和rpmfushion两个软件大仓库
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-nonfree-release-6-0.1.noarch.rpm
如果是centos 5 的话执行下面
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/i386/rpmfusion-free-release-5-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/5/i386/rpmfusion-nonfree-release-5-0.1.noarch.rpm
接着安装起来就很方便拉,~根本不需要去下载就可以获得最新的版本
yum install phpmyadmin
安装完成后还需要配置一下访问权限,使得出了本机外,其他机子也能访问phpMyAdmin
vi /etc/httpd/conf.d/phpMyAdmin.conf
找到两个directory的权限设置,Allow from 改成All
<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from All
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from All
</Directory>
重启服务器
service httpd restart
测试localhost/phpMyAdmin
用户名密码:root 123456
OK~ LAMP搭建完毕,
8.搭建SSL,让apache支持https
yum install mod_ssl
其实安装完这个模块后,重启完apache 就可以用https://localhost测试了,因为他创建了默认的证书
在/etc/pki/tls下
当然我们也可以用openssl创建自己的证书
yum install openssl
生成证书文件
创建一个rsa私钥,文件名为server.key
openssl genrsa -out server.key 1024
Generating RSA private key, 1024 bit long modulus
............++++++
............++++++
e is 65537 (0x10001)
用 server.key 生成证书签署请求 CSR
openssl req -new -key server.key -out server.csr
Country Name:两个字母的国家代号
State or Province Name:省份名称
Locality Name:城市名称
Organization Name:公司名称
Organizational Unit Name:部门名称
Common Name:你的姓名
Email Address:地址
至于 'extra' attributes 不用输入.直接回车
生成证书CRT文件server.crt。
openssl x509 -days 365 -req -in server.csr -signkey server.key -out server.crt
修改ssl.conf指定我们自己生成的证书
vi /etc/httpd/conf.d/ssl.conf
找到如下位置,修改路径
# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
OK
service httpd restart
一切都搞定拉~~
整个过程我们不需要修改/etc/httpd/conf/httpd.conf 这就是版本高了的好处阿~
mysql 的设置的更多相关文章
- Mysql字符集设置
转 基本概念 • 字符(Character)是指人类语言中最小的表义符号.例如’A'.’B'等:• 给定一系列字符,对每个字符赋予一个数值,用数值来代表对应的字符,这一数值就是字符的编码(Encodi ...
- Ubuntu 16.04 安装mysql并设置远程访问
说明: 一个朋友在使用ubuntu-server 16.04安装mysql,设置远程访问的时候出现了问题,请我帮忙.但是,我也没有使用过ubuntu安装mysql,于是乎搜索了很多技术文件,比着葫芦画 ...
- 微信nickname乱码及mysql编码格式设置(utf8mb4)
微信nickname乱码及mysql编码格式设置(utf8mb4) 今天在写微信公众平台项目时,写到一个用户管理模块,接口神马的已经调试好了,于是将用户从微信服务器保存到本地数据库,发现报错: jav ...
- Mysql 如何设置字段自动获取当前时间
应用场景: 1.在数据表中,要记录每条数据是什么时候创建的,不需要应用程序去特意记录,而由数据数据库获取当前时间自动记录创建时间: 2.在数据库中,要记录每条数据是什么时候修改的,不需要应用程序去特意 ...
- xampp默认mysql密码设置,修改mysql的默认空密码
xampp默认mysql密码设置,修改mysql的默认空密码 分类: xampp2012-09-12 11:24 30264人阅读 评论(5) 收藏 举报 mysqlphpmyadminauthent ...
- [原创]java WEB学习笔记78:Hibernate学习之路---session概述,session缓存(hibernate 一级缓存),数据库的隔离级别,在 MySql 中设置隔离级别,在 Hibernate 中设置隔离级别
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
- mysql datetime设置now()无效,直接用程序设置默认值比较好
mysql datetime设置now()无效的,没有此用法,datetime类型不能设置函数式默认值,只能通过触发器等来搞.想设置默认值,只能使用timestamp类型,然后默认值设置为:CURRE ...
- MySQL 字符集设置
/*************************************************************************** * MySQL 字符集设置 * 说明: * 数 ...
- Windows Server 2003开机自动启动MySQL服务设置方法
Windows Server 2003开机自动启动MySQL服务设置方法 发布时间:2014-12-19 更新时间:2014-12-24 来源:网络 作者:eaglezhong 关键词: 2003 e ...
随机推荐
- Linux 读书笔记 一
一.Linux 简介 实验介绍 本节主要介绍 Linux 的历史,Linux 与 Windows 的区别等入门知识.如果你已经有过充分的了解,可以跳过本节,直接进入下一个实验. 一.Linux 为何物 ...
- 实验二 Linux下C语言编程基础
1. 熟悉Linux系统下的开发环境 2. 熟悉vi的基本操作 3. 熟悉gcc编译器的基本原理 4. 熟练使用gcc编译器的常用选项 5 .熟练使用gdb调试技术 6. 熟悉makefile基本原理 ...
- Java JSON、XML文件/字符串与Bean对象互转解析
前言 在做web或者其他项目中,JSON与XML格式的数据是大家经常会碰见的2种.在与各种平台做数据对接的时候,JSON与XML格式也是基本的数据传递格式,本文主要简单的介绍JSON/XML ...
- 支持Ajax跨域访问ASP.NET Web Api 2(Cors)的简单示例教程演示
随着深入使用ASP.NET Web Api,我们可能会在项目中考虑将前端的业务分得更细.比如前端项目使用Angularjs的框架来做UI,而数据则由另一个Web Api 的网站项目来支撑.注意,这里是 ...
- 定制类自己的的new_handler
C++中的new操作符首先使用operator new函数来分配空间,然后再在此空间上调用类的构造函数构造对象.当operator new无法分配所需的内存空间时,默认的情况下会抛出一个bad_all ...
- linux下安装openssh-server
csdn博文地址:linux下安装openssh-server 点击进入 系统是ubuntu14.04,系统默认安装了openssh-client,但没有安装openssh-server,需要手动 ...
- [poj1742]coin
题意:多重背包的w=v特殊情况 分析:此题如果用单调队列O(nv)会被无耻卡常数…… 然后鉴于此题W=V,所以只存在背包恰好为i的是否存在,即bool型的f[i]是否为1 即往背包染色上面考虑 如果是 ...
- Scala 中的函数式编程基础(一)
主要来自 Scala 语言发明人 Martin Odersky 教授的 Coursera 课程 <Functional Programming Principles in Scala>. ...
- linq入门系列导航
写在前面 为什么突然想起来学学linq呢?还是源于在跟一个同事聊天的时候,说到他们正在弄得一个项目,在里面用到了linq to sql.突然想到距上次使用linq to sql是三年前的事情了.下班回 ...
- C语言总结(6)
1.表达式: 算数表达式: 单目:+, -, ++, --. 双目:+,-,*,/,%. 赋值表达式: 简单赋值:= 复合赋值:+=,-=,*=,,/=%=,!=. 关系表达式: >,>= ...