如何删除Nginx

删除nginx,–purge包括配置文件

sudo apt-get --purge remove nginx 

自动移除全部不使用的软件包

sudo apt-get autoremove 

列出与nginx相关的软件 并删除显示的软件

dpkg --get-selections|grep nginx sudo apt-get --purge remove nginx 
sudo apt-get --purge remove nginx-common 
sudo apt-get --purge remove nginx-core 

再次执行

dpkg --get-selections|grep nginx which nginx # 不再显示nginx /////////////// mysql远程登陆权限问题汇总和localhost 

原创qq_34567703 最后发布于2017-08-15 14:44:27

阅读数 264 收藏 展开

刚刚安装好mysql时,root用户是没有密码的,可以直接用

mysql -u root -p

然后回车登陆,用

set password for root@localhost=password('root'); 

将root用户密码设置为root。退出。重新登陆,输入密码root,进入mysql。至此mysql的root用户密码设置成功。 但是,如果我想用另一个ip来访问这个mysql,发现access denied。这是因为mysql默认不支持远程访问,需要给root用户输入以下命令

grant all privileges on <em>.</em> to 'root'@'%' identified by 'root' with grant option; 
flush privileges; 

这样给所有用户都赋予了远程登录root账户的权限,登陆的时候输入密码root即可。我们也可以创建一个别的账户hive,

create user 'hive' identified by 'hive'; 

然后也给予它权限,

grant all privileges on <em>.</em> to 'hive'@'djt11' identified by 'hive'; 

如果想让所有ip都能登陆,将djt11换成%即可。 我们这时可以来看看用户表,

select host,user from mysql.user; 
location ~ .php$ { include snippets/fastcgi-php.conf; 
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; } 

看起来很完美对吗?的确,通常这样设置后,也不会出现什么错误了。但是,如果我们足够细心的话,用不同的方式登陆,会发现很多不能理解的地方。 比如我这样登陆

mysql -h djt11 -u hive -p,

然后输入密码,是可以登陆的,

show databases

可以看到root用户一样的界面 这是因为我们之前将mysql所有权限都赋予了hive用户。 如果我们这样登陆,

mysql -u hive,

发现这样是可以直接登陆mysql的,不需要输入密码。然而登陆进去以后

show databases,

却只能看到如下内容 我猜测这个登录方式可能是在刚刚创建hive用户时产生的,这时我们还没有给hive用户什么权限,所以登陆进来看到的界面跟root用户是不一样的。不过这个并不影响什么。 接下来我尝试了这样登陆, mysql -h djt11 -u hive,出现了错误提示 好像有点奇怪,为什么mysql -u hive可以登陆,而加个远程访问 -h djt11就不行了呢?这是因为我们之前的命令

grant all privileges on <em>.</em> to 'hive'@'djt11' identified by 'hive';

严格限制了用 -h djt11 登陆hive用户必须用密码。同样,我们还设置了‘hive’@‘%’,所以任何远程访问都必须要输入密码。mysql -u hive 这种登陆方式我们可以暂时不管,因为我们需要的就是hive用户拥有所有mysql权限,所以我们并不会用到mysql -u hive这种登陆方式,它也不会对我们的操作产生任何影响。远程访问时,老老实实输入

mysql -h djt11 -u hive -p

然后输入密码即可。 那么,我们再回过头来看看用户表 root用户的host,有%、127.0.0.1、localhost、djt11,看上去无懈可击,怎么登陆都行。但其实有很多奇怪的地方。 比如我这样登陆,mysql -h djt11,发现不用输入密码也可以登陆root账户。这可能是因为之前grant权限时没有限定要输入密码,改过来即可。 同理,如果输入 mysql -h djt11 -u root也可以直接登陆,因为不输入-u root时默认登陆root账户,也是由于grant root@% 时没有限定要输入密码的问题。 但是,如果输入

mysql -h localhost -u root

却发现不能直接登陆。输入 mysql -u root也不能直接登陆。很奇怪,既然grant root@%时没有限定要输入密码,为什么 -h djt11可以登陆, -h localhost就不行呢? “%”不是代表所有ip吗? 查询mysql官方文档可以发现,%并不包括localhost!! 所以,如果想同意远程访问和本地访问的访问方式,一定要分别对%和localhost进行授权!! 这样,无论是远程访问还是本地访问,都要

mysql -h djt11 -u root -p <em><span style="color:#a30500" class="has-inline-color">输入密码登陆</span></em>,

djt11换成localhost也可以了。 这有什么好处呢? 当我们在搭建hadoop分布式集群时,会将mysql安装在其中一个节点上。如果用sqoop import一个数据表时,会涉及到登陆要不要密码的问题,如果没有上面这些设置,会出现各种错误。如果将%和localhost都设置好权限,则不会出现任何登陆权限问题。 ———————————————— 版权声明:本文为CSDN博主「qq_34567703」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_34567703/article/details/77189665 安装Nginx并对root授权,新建 $ sudo apt-get install nginx $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful 但是访问 192.168.1.xxx 显示 乱码:Nginx work鈥檚 ! 可能是 Nginx work INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES(“10.155.123.55″,” mysql> INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES(“10.155.123.55″,”kaka”,PASSWORD(“kaka123″),””,””,””); INSERT INTO user(Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,ssl_type,ssl_cipher,x509_issuer,x509_subject,max_questions,max_updates,max_connections,max_user_connections,plugin,authentication_string,password_expired) VALUES (‘%’,’root’,’*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9′,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,”,”,”,”,0,0,0,0,’mysql_native_password’,”,’N’); wordpress: server { listen 80; root /var/www/html/wordpress; index index.php; server_name 192.168.1.122 www.myass.ml; access_log /var/log/nginx/Myass.ml.access_log; error_log /var/log/nginx/Myass.ml.error_log notice; location / { try_files $uri $uri/ /index.php?$args; } location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php7.3-fpm.sock; } } root@raspberrypi:/home/pi# systemctl status nginx.service

nginx.service – A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2020-01-29 12:17:13 CST; 12s ago Docs: man:nginx(8) Process: 860 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited 1月 29 12:17:12 raspberrypi systemd[1]: Starting A high performance web server and a reverse pr 1月 29 12:17:13 raspberrypi nginx[860]: nginx: [emerg] open() “/etc/nginx/sites-enabled/192.168 1月 29 12:17:13 raspberrypi nginx[860]: nginx: configuration file /etc/nginx/nginx.conf test fa 1月 29 12:17:13 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, sta 1月 29 12:17:13 raspberrypi systemd[1]: nginx.service: Failed with result ‘exit-code’. 1月 29 12:17:13 raspberrypi systemd[1]: Failed to start A high performance web server and a rev lines 1-12/12 (END) 2020/01/29 12:02:53 [emerg] 15756#15756: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62 2020/01/29 12:09:32 [emerg] 16028#16028: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62 2020/01/29 12:10:16 [emerg] 376#376: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62 2020/01/29 12:10:16 [emerg] 377#377: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62 2020/01/29 12:12:39 [emerg] 658#658: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62 2020/01/29 12:17:13 [emerg] 860#860: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62 2020/01/29 12:30:35 [emerg] 1257#1257: open() “/etc/nginx/sites-enabled/192.168.1.122” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62