centos安装指定mysql
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 80; 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 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html; try_files $uri =404; fastcgi_pass 127.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; #} }
Linux/UNIX 上安装 MySQL
Linux平台上推荐使用RPM包来安装Mysql,MySQL AB提供了以下RPM包的下载地址:
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/
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
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...
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
#vim /etc/my.cnf(注:windows下修改的是my.ini)
在文档内搜索mysqld定位到[mysqld]文本段:
/mysqld(在vim编辑状态下直接输入该命令可搜索文本内容)
在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程,如下图所示:
mysql> use mysql;
mysql> update user set password=password("你的新密码") where user="root";
mysql> quit
5.编辑my.cnf,去掉刚才添加的内容,然后重启MySQL。大功告成!
在成功安装 MySQL 后,一些基础表会表初始化,在服务器启动后,你可以通
过简单的测试来验证 MySQL 是否工作正常。
使用 mysqladmin 工具来获取服务器状态:
使用 mysqladmin 命令俩检查服务器的版本, 在 linux 上该二进制文件位
于 /usr/bin 目录,在 Windows 上该二进制文件位于C:\mysql\bin 。
[root@host]# mysqladmin --version
mysqladmin Ver 8.42 Distrib 5.7.25, for Linux on x86_64
作者:疯刘小三
来源链接:https://www.cnblogs.com/Crazy-Liu/p/10911914.html
版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。
2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。