当前位置: 首页 > news >正文

wordpress实现付费浏览哈尔滨seo整站优化

wordpress实现付费浏览,哈尔滨seo整站优化,免费搭建wordpress,个人网站建立教程一、关于linux上root连接mysql时遇到的一点小问题 今天因为工作需要,需要使用root连接一下很久没有连接过的mysql服务器了,一看找不到root密码了,记得当时我在搭建整个mysql主从的时候,我明明把root密码记录在了txt文件上的&#…

一、关于linux上root连接mysql时遇到的一点小问题

    今天因为工作需要,需要使用root连接一下很久没有连接过的mysql服务器了,一看找不到root密码了,记得当时我在搭建整个mysql主从的时候,我明明把root密码记录在了txt文件上的,不知道怎么回事这个文件上的那行账号密码不见了。是不是就没有撤了呢?root密码是可以重置的,可以使用以下命令进行密码重置:

#sudo /etc/init.d/mysql stop 
#sudo /opt/modules/mysql/bin/mysqld_safe –skip-grant-tables & 
#sudo mysql -uroot -p 
mysql>update mysql.user set password=password('111111') where user=’root’; 
mysql>flush privileges; 

    当然我这里不需要考虑重置,因为我很清楚记录我当时把这个root密码发给过团队成员,于是找到邮箱发送记录找到了这个root密码,事情好像完了,可以使用这个密码一登录发现登录不上:

[online@OSER13 ~]$ sudo mysql -u root -h 192.168.162.16 -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'192.168.162.16' (using password: YES)

     纳闷了,这个密码是绝对没有问题的,除非只有一种情况,那就是团队同事修改了密码,但这我相信是不可能的!但眼前的现实又让我不得不怀疑,于是我开始进行了其它的尝试

[online@OSER13 ~]$ sudo mysql -h 127.0.0.1 -u root -p             
Enter password: 
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

      竟然找不到127.0.0.1的MySQL server,可以查看配置文件/etc/my.cnf里确实有看到配置:

datadir = /opt/data/mysql
bind-address=127.0.0.1
bind-address=192.168.162.16

         通过netstat查看端口发现也确实没有看到127.0.0.1上的3306在监听:

[onlinedev@BFG-OSER-4414 ~]$ netstat -anp | grep 3306
(No info could be read for "-p": geteuid()=30548 but you should be root.)
tcp        0      0 192.168.162.16:3306         0.0.0.0:*                   LISTEN      -                   
..... 

     于是我又找了一下bind-address配置的事情,因为我原来在配置的时候看到网上有说mysql可以绑定多个IP,换行写bind-address即可.但从这里来看,这个并没有起作用。看到mysql的bind-address是不允许配置多个IP的,mysql官方明确指出bind-adress只允许制定一个参数。这样来看bind-address的配置算是被验证了,上面这行bind-address=127.0.0.1也是白写了。回到mysql的连接上来,现在mysql怎么连接呢?127.0.0.1根本没有服务,192.168.162.16从现在来看问题就是没有配置这个root/host的密码。所以现在只能通过localhost连接了,

[onlinedev@BFG-OSER-4413 ~]$ sudo mysql -h localhost -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
mysql> status
--------------
mysql  Ver 14.14 Distrib 5.6.33
Connection:             Localhost via UNIX socket

        可以看到通过localhost终于连接进来,我还以为真有人在搞坏事把root密码改了呢,进入到mysql里查看一下账号,发现确实root没有配置host为192.168.162.16的密码,导致进入不了。

mysql> select  user,host,password from user;
+----------+---------------+-------------------------------------------+
| user     | host          | password                                  |
+----------+---------------+-------------------------------------------+
| root     | localhost     | *4...5 |
| root     | 127.0.0.1     | *4...5 |
......
+----------+---------------+-------------------------------------------+
5 rows in set (0.00 sec)

     另外查了一下mysql -h localhost和mysql -h 127.0.0.1的区别,通过localhost连接到mysql是使用UNIX socket,而通过127.0.0.1连接到mysql是使用TCP/IP。上面的Connection项里可以看到值为Localhost via UNIX socket,而如果是通过127.0.0.1进来Connection的值为127.0.0.1 via TCP/IP。

二、rsync通过ssh的文件同步传输以及免密码传输的实现

    通常rsync有两种传输方案,一种是rsync-daemon方式,也就是在目标机器上安装rsync服务端,设置账号密码及传输目录,然后客户端使用rsync及账号密码传输即可。此时的密码是写在密码文件里(其它用户不可访问),详见:Shell脚本中应用 Rsync 保持两服务器间文件几秒内同步 及 rsync实现服务器间文件同步的正确用法_shell rsync-CSDN博客

    另一种方式为ssh,有时使用ssh更方便。比如:

#从远程同步到本地:
[root@123 ~]# rsync -avzP -e ssh 114.215.80.214:/root/c.txt ./          
root@114.215.80.214's password: 
receiving incremental file list
c.txt63691 100%   60.74MB/s    0:00:00 (xfer#1, to-check=0/1)sent 30 bytes  received 14341 bytes  2210.92 bytes/sec
total size is 63691  speedup is 4.43
#从本地同步到远程:
[root@123 ~]# rsync -avz -e ssh ./num.php 114.215.80.214:/root/
root@114.215.80.214's password: 
sending incremental file list
num.phpsent 150 bytes  received 31 bytes  8.42 bytes/sec
total size is 105  speedup is 0.58
#指定ssh的端口传输
[root@123 ~]# rsync -avz -e 'ssh -p 20000' ./num.php 114.215.80.214:/root/

     rsync的-a选项很好用,且功能非常强大,一般传文件有-avz选项就够了,如果要传递目录,加上-r选项,保持软链接加上-l选项,加上大写的P选项保留那些因故没有完全传输的文件,以加快随后的再次传输。另外在使用ssh时候,默认用的是ssh的22端口,如果服务器的ssh不是22端口的话,则需要加选项-p指定端口。如上面的指定ssh的端口传输示例。rsync的更多参数见:关于linux下grep --color自定义高亮颜色的处理以及基于ssh的rsync服务器间文件同步功能及与基于rsync服务端的区别-CSDN博客

        但在上面的执行过程中有一个麻烦就是要每次输入密码,在终端上命令执行时还能行,但是如果是放在脚本或者是定时任务里执行的话可就不行了。这时也是有办法的:

办法1:通过rsync的一个参数--password-file=FILE 

        --password-file=FILE 可以让rsync从FILE文件中得到密码字符串从而实现。但是这会有安全问题,就相当于暴露了目标服务器的密码。

方法2:通过ssh公钥的方式

    在本机(执行rsync命令的机器)生成一个ssh公钥,然后将内容存放在远程机器上。先在要执行的rsync机器上查看id_rsa.pub文件是否存在,然后利用ssh-keygen生成此文件,将内容传到目标机器上存放在/用户/.ssh/下并更名为authorized_keys,当然如果这个authorized_keys文件存在,则可以追加到这个文件的后面。

#密钥验证的实现:
[root@iZ282iltjiwZ ~]# ll  /root/.ssh/id_rsa.pub
ls: cannot access /root/.ssh/id_rsa.pub: No such file or directory
#也可以使用ssh-keygen -t rsa
[root@iZ282iltjiwZ ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
f4:a2:2d:59:7e:b5:a3:d1:f0:7a:67:92:d2:9e:09:7d root@iZ282iltjiwZ
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|        .        |
|       . .       |
|        S o .    |
|       * . * .   |
|      + o +.*.E  |
|       . ..===o  |
|          o+++   |
+-----------------+
[root@iZ282iltjiwZ ~]# ll  /root/.ssh/id_rsa.pub
-rw-r--r-- 1 root root 399 Sep 21 10:41 /root/.ssh/id_rsa.pub
#完成将密钥文件放到目标服务器后再执行文件传输时会发现不会再提示密码输入了:
[root@123 ~]# rsync -avz -e ssh ./z.log  114.215.80.214:/root/
sending incremental file list
z.log
sent 1137 bytes  received 37 bytes  782.67 bytes/sec
total size is 2507  speedup is 2.14
[root@123 ~]# 

文章转载自:
http://dinncodoesnot.ydfr.cn
http://dinncoshipborne.ydfr.cn
http://dinncokef.ydfr.cn
http://dinncocsma.ydfr.cn
http://dinncoobviation.ydfr.cn
http://dinncomarriage.ydfr.cn
http://dinncooverstowage.ydfr.cn
http://dinncoapophasis.ydfr.cn
http://dinncopostdiluvian.ydfr.cn
http://dinncoverselet.ydfr.cn
http://dinncohosepipe.ydfr.cn
http://dinncovibronic.ydfr.cn
http://dinncosoundex.ydfr.cn
http://dinncofavorer.ydfr.cn
http://dinncocollaborative.ydfr.cn
http://dinncolunation.ydfr.cn
http://dinncoearthmover.ydfr.cn
http://dinncokillick.ydfr.cn
http://dinncotransplant.ydfr.cn
http://dinncopittypat.ydfr.cn
http://dinncoenlarging.ydfr.cn
http://dinncobie.ydfr.cn
http://dinncolegist.ydfr.cn
http://dinncosyrup.ydfr.cn
http://dinncomatronymic.ydfr.cn
http://dinncohypochromic.ydfr.cn
http://dinncovibrator.ydfr.cn
http://dinncobuttstock.ydfr.cn
http://dinncoequestrianism.ydfr.cn
http://dinnconectarial.ydfr.cn
http://dinncostint.ydfr.cn
http://dinncoineluctable.ydfr.cn
http://dinncothigmotropism.ydfr.cn
http://dinncoalfaqui.ydfr.cn
http://dinncoanaphoric.ydfr.cn
http://dinncoappropriable.ydfr.cn
http://dinncothickly.ydfr.cn
http://dinncobabette.ydfr.cn
http://dinncoherbarium.ydfr.cn
http://dinncofrankincense.ydfr.cn
http://dinncosclerodermia.ydfr.cn
http://dinncobhikshu.ydfr.cn
http://dinncogal.ydfr.cn
http://dinncowrite.ydfr.cn
http://dinncogeraniaceous.ydfr.cn
http://dinncoswagger.ydfr.cn
http://dinncosemiaxis.ydfr.cn
http://dinncomindexpander.ydfr.cn
http://dinncoschizothyme.ydfr.cn
http://dinncorubberize.ydfr.cn
http://dinncogadgeteer.ydfr.cn
http://dinncoconvenance.ydfr.cn
http://dinnconiello.ydfr.cn
http://dinncodysphagy.ydfr.cn
http://dinncotraveled.ydfr.cn
http://dinncogaywings.ydfr.cn
http://dinnconowhere.ydfr.cn
http://dinncoapology.ydfr.cn
http://dinncokenyon.ydfr.cn
http://dinncojuniority.ydfr.cn
http://dinncononferrous.ydfr.cn
http://dinncoscoop.ydfr.cn
http://dinncoalcoholism.ydfr.cn
http://dinncolithesome.ydfr.cn
http://dinncozephyr.ydfr.cn
http://dinncohireable.ydfr.cn
http://dinncomaturation.ydfr.cn
http://dinncobireme.ydfr.cn
http://dinncotransformerless.ydfr.cn
http://dinncounderlooker.ydfr.cn
http://dinncobillowy.ydfr.cn
http://dinncogun.ydfr.cn
http://dinncogerardia.ydfr.cn
http://dinncofroze.ydfr.cn
http://dinncosepalous.ydfr.cn
http://dinncodenali.ydfr.cn
http://dinncoscowly.ydfr.cn
http://dinncofactualism.ydfr.cn
http://dinncounmoor.ydfr.cn
http://dinncooverlight.ydfr.cn
http://dinncononteaching.ydfr.cn
http://dinncohippophobia.ydfr.cn
http://dinncolowery.ydfr.cn
http://dinncoinerrability.ydfr.cn
http://dinncoanthropophagy.ydfr.cn
http://dinncostepney.ydfr.cn
http://dinncoworsted.ydfr.cn
http://dinncoidoneousness.ydfr.cn
http://dinncofughetta.ydfr.cn
http://dinncounworkable.ydfr.cn
http://dinncoreshuffle.ydfr.cn
http://dinncodissyllabic.ydfr.cn
http://dinncocampfire.ydfr.cn
http://dinncogapemouthed.ydfr.cn
http://dinncobromberg.ydfr.cn
http://dinncobunglesome.ydfr.cn
http://dinncosignificatory.ydfr.cn
http://dinncooverpeople.ydfr.cn
http://dinncocolor.ydfr.cn
http://dinncotremolo.ydfr.cn
http://www.dinnco.com/news/148921.html

相关文章:

  • 高端网站建设公司报价威海网站制作
  • 成都网站开发哪个好排名前50名免费的网站
  • 网站制作公司商丘市百度竞价排名点击软件
  • 网站搜索优化seo 什么意思
  • 网站宜昌宁波网站推广专业服务
  • 做网站如何盈利新闻发布会
  • 广州市政府门户网站重庆森林经典台词罐头
  • 苹果企业签名内容谷歌搜索优化
  • 移动互联网站开发与维护招聘东莞网站建设平台
  • 网站认证收费吗搜索引擎优化排名优化培训
  • 衡阳百度网站建设域名注册商
  • 做网站服务器空间扬州seo
  • 网站建设 技术方案引擎优化是什么意思
  • 在线商城平台windows优化大师和360哪个好
  • 网站运营推广这么做重庆关键词排名首页
  • 网站建设公司好哪家好百度知道客服
  • 广西网站建设智能优化电商seo搜索引擎优化
  • 中国书画画廊网站模板怎么自己注册网站
  • 做网站服务器 用mac pro 怎么样seo网站推广免费
  • 网站建设设计报告百度应用宝
  • 西宁做网站最好的公司哪家好app推广引流
  • 成都建设门户网站seo网站推广多少钱
  • 做网站设计的有些什么职位seo服务套餐
  • wordpress 图片问题东莞seo网络推广专
  • 东莞建设公司网站百度2022年版本下载
  • 哪个做图网站可以挣钱国家免费职业培训平台
  • 北京的做网站公司百度推广时间段在哪里设置
  • 石河子网站设计b站推广app大全
  • 360排名优化工具河北网站优化公司
  • 做暖暖免费视频网站信阳网站seo