admin管理员组

文章数量:1602097

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

nginx下载地址

我下载是这个

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

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

rpm-ivh http://nginx/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/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic/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://wwwblogs/yanqingxu/p/9248849.html

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

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

server {

listen80;

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_page404 /404.html;

# redirect server error pages to thestatic page /50x.html

#

error_page500 502 503 504 /50x.html;

location= /50x.html {

root/usr/share/nginx/html;

}

# proxy the PHP scripts to Apache listening on127.0.0.1:80#

#location~\.php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on127.0.0.1:9000#

location~\.php$ {

root/usr/share/nginx/html;

try_files $uri=404;

fastcgi_pass127.0.0.1:9000;

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/downloads/repo/yum/

wget http://repo.mysql/mysql57-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/myf(注: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账户就已经重置成新的密码了。

5.编辑myf,去掉刚才添加的内容,然后重启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

本文标签: 一键liumysqlmysqlcentos