mysql下载地址:http://repo.mysql.com/

nginx下载地址

我下载是这个

http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install -y nginx

php安装yum

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel

参考链接:https://www.cnblogs.com/yanqingxu/p/9248849.html

当安装好lnmp之后网站解析php文件出:File not found 错误 nginx,参考https://www.cnblogs.com/iosdev/p/3439834.html

下面贴正确能打开php的nginx.conf

server {
listen ;
server_name localhost; #charset koi8-r;
#access_log /var/log/nginx/host.access.log main; location / {
root /usr/share/nginx/html;
index index.html index.htm index.php;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
location ~ \.php$ {
root /usr/share/nginx/html;
try_files $uri =;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

nginx.conf

Linux/UNIX 上安装 MySQL

Linux平台上推荐使用RPM包来安装Mysql,MySQL AB提供了以下RPM包的下载地址:

   MySQL -
MySQL服务器。你需要该选项,除非你只想连接运行在另一台机器上的MySQL服务器。
    MySQL-client
- MySQL 客户端程序,用于连接并操作Mysql服务器。
    MySQL-devel
- 库和包含文件,如果你想要编译其它MySQL客户端,例如Perl模块,则需要安装该RPM包。
    MySQL-shared
- 该软件包包含某些语言和应用程序需要动态装载的共享库(libmysqlclient.so*),使用MySQL。
    MySQL-bench
- MySQL数据库服务器的基准和性能测试工具。

安装前,我们可以检测系统是否自带安装 MySQL:

rpm -qa | grep mysql

如果你系统有安装,那可以选择进行卸载:

rpm -e mysql  // 普通删除模式
rpm -e --nodeps mysql  //
强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除

安装 MySQL:

接下来我们在 Centos7 系统下使用 yum 命令安装 MySQL,需要注意的是 CentOS 7 版本中
MySQL数据库已从默认的程序列表中移除,所以在安装前我们需要先去官网下载 Yum
资源包,下载地址为:https://dev.mysql.com/downloads/repo/yum/

wget http://repo.mysql.com/mysql-community-release-el6-9.noarch.rpm          
####版本根据需求和环境可以直接修改字符自定义。

rpm -ivh mysql57-community-release-el6-9.noarch.rpm

yum install mysql-server
 
安装好后要是直接mysql -u root -p报错:
[root@localhost tools]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through
socket '/var/lib/mysql/mysql.sock' (2)
这个报错一般是权限和服务没启动,我这是服务没启动。查看状态后重启即可:
[root@localhost tools]# /etc/init.d/mysqld status
mysqld is stopped
[root@localhost tools]# /etc/init.d/mysqld start
Initializing MySQL
database:                              
[  OK  ]
Starting
mysqld:                                          
[  OK  ]
[root@localhost tools]# /etc/init.d/mysqld status
mysqld (pid  19942) is running...
 
[root@localhost tools]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
 
登录输入密码回车后错误,这个是因为密码错误,大可以直接重置密码即可:
 
1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下:

#vim /etc/my.cnf(注:windows下修改的是my.ini)

在文档内搜索mysqld定位到[mysqld]文本段:
/mysqld(在vim编辑状态下直接输入该命令可搜索文本内容)

在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程,如下图所示:


保存文档并退出:

#:wq
2.接下来我们需要重启MySQL:

/etc/init.d/mysql restart(有些用户可能需要使用/etc/init.d/mysqld
restart)

3.接下来就是用sql来修改root的密码
mysql> use mysql;
mysql> update user set password=password("你的新密码") where
user="root";
这一步要是报错:ERROR 1054 (42S22): Unknown column 'password' in
'field list'
是因为mysql5.7后数据库下已经没有password这个字段了,password字段改成了authentication_string
所以更改语句替换为update mysql.user set
authentication_string=password('root') where user='root'
;即可
mysql> flush privileges;
mysql> quit
到这里root账户就已经重置成新的密码了。
 
还有一个报错是一定要先alter修改密码的https://www.cnblogs.com/Crazy-Liu/p/10912599.html
5.编辑my.cnf,去掉刚才添加的内容,然后重启MySQL。大功告成!
 
 
验证 MySQL 安装
在成功安装 MySQL 后,一些基础表会表初始化,在服务器启动后,你可以通

过简单的测试来验证 MySQL 是否工作正常。

使用 mysqladmin 工具来获取服务器状态:

使用 mysqladmin 命令俩检查服务器的版本, 在 linux 上该二进制文件位

于 /usr/bin 目录,在 Windows 上该二进制文件位于C:\mysql\bin 。

[root@host]# mysqladmin --version

 
linux上该命令将输出以下结果,该结果基于你的系统信息:

mysqladmin  Ver 8.42 Distrib 5.7.25, for Linux on
x86_64

 
 

最新文章

  1. mybatis动态SQL - like
  2. Oracle RAC 连接
  3. raspberrypi VNC server
  4. poj1185炮兵阵地
  5. 上海及周边地区产品技术创业QQ群:98905958
  6. js中变量的作用域、变量提升、链式作用域结构
  7. shopnc验证码显示不了
  8. 【dp】友好城市
  9. C++ STL学习之 空间配置器(allocator)
  10. Git常用命令(一)
  11. 安装CentOS 7 的yum 到 Radhat 7上,使其可以获取资源
  12. PHP取微信access_token并全局存储与更新
  13. XML注释与取消注释快捷键
  14. iframe+form上传文件
  15. Android Service总结04 之被绑定的服务 -- Bound Service
  16. HighCharts使用总结
  17. 60行代码:Javascript 写的俄罗斯方块游戏
  18. 洛谷P1789【Mc生存】插火把 题解
  19. 洛谷11月月赛题解(A-C)
  20. python3.6 子类的__init__调用父类的__init__

热门文章

  1. 【CV论文阅读】Two stream convolutional Networks for action recognition in Vedios
  2. event loop js事件循环 microtask macrotask
  3. 1. FrogRiverOne 一苇渡江 Find the earliest time when a frog can jump to the other side of a river.
  4. [Vue + TS] Watch for Changes in Vue Using the @Watch Decorator with TypeScript
  5. Python网络爬虫(一):初步认识网络爬虫
  6. nmap,port扫描,获取sshserver的ip地址
  7. 记录 mysql sql limit 0,100问题
  8. 洛谷 P2055 [ ZJOI 2009 ] 假期的宿舍 —— 二分图匹配
  9. 面向对象软件工程与UML
  10. jeesite ckeditor数据库 HTML 被编码 的问题解决