Synology phpMyAdmin, MariaDB 5 and MariaDB 10

架设在群晖Synology的wordpress有一些古怪的脾气。如果把一个很大的.sql文件经由phpMyAdmin输入,这个过程不一定能成功。曾经试过好多回不能把.sql文件导入数据库,放弃的时候才发现不清不楚下已把.sql文件成功导入。

这里提供另一个比较保险的方式导入.sql文件。首先在群晖里把ssh打开。然后再打开putty,键入 [email protected].(群晖IP)。要注意的是必须在群晖用户里授权使用这个(admin) 。进入putty ssh后键入密码。

如果数据库使用MariaDB 10,那么sql的文件夹在

/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin

键入以下指令:

cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin

然后再键入这一个主要指令以导入数据。这里先要把.sql文件上载到群晖里。

./mysql -uroot -ppassword my_db < /volume1/文件路径/文件.sql

个人猜想如果数据库没使用root用户的话,那么uroot要改成uusername

也可以把两个指令一次性的导入。

/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin/mysql -uroot -ppassword my_db < /volume1/文件路径/文件.sql

如果数据库是MariaDB 5的话,路径也有所不同。

/volume1/@appstore/MariaDB/usr/bin

接下来的导入指令与MariaDB 5的没分别。

虽然没用到,但是未来兴许会用到的备份方式。

./mysqldump -uroot -ppassword my_db > /volume1/文件路径/文件.sql

ASUS RT AC88U(华硕)

之前的路由器退款了,终于可以买属意的机器了!

一番调查,发现华硕路由器RT AC88U网上风评不错,只是在市场上至少有2年了。淘宝上卖人民币1299, 换算等于马币776.20 。在刘蝶广场卖马币1629 ,吃水很深。虽然有打算直接从淘宝买,最后还是在本地买卖网shopee买,只要马币873.00 。买到以后有种暗爽的感觉,赚大了!

3月7日下单付款,物流流程过了很多天都没有资料。直到15日才出现资料。最气人的是物流公司告知必须等隔天才送货,理由是住宅区保安森严,过关很花时间,必须等星期六把其他送到住宅区的货集齐才一次过送交。

不等了,直接杀到物流公司自己提货。

办公室。说实话,有点简陋。

包裹,包得很令人放心。

开这一层保护膜很费功夫。


主角登场。。。。

附送的2个电源适配器。

盒子角落有撞击过的痕迹,不知是运输过程引致的,抑或未包装前已有的。

刘蝶广场内里两间店都卖马币1629,省下马币756 ,赚到了!!

网页存储时间线

2015年

11月
把网页架设在hourB, 没有域名。

11月27日
把网页架设在Co.nf,有着自选的域名。但需要用VPN 访问。写这文章的时候,vpn访问已经不需要了。

12月6日
把tk域名投向hourB网站空间服务。

2016年

1月10日
在本地电脑架设网页。

1月12日
把网页及专属域名放到1&1空间服务。

2月5日
注销1&1空间服务

5月
启用付费godaddy空间服务。开始接触Amazon云服务

2019年

2月8日
研究谷歌云

2月10日
成功在谷歌云架设网页及域名投射。

2月下旬
成功在家用网络存储架设网页及域名投射。只不过网页不能以根域名显示

3月初
家用存储的网页成功用根域名显示。

Synology架设网页

家里架设网页可以省下每年的网页储存伺服器费,当然也有相应的其他问题。趁着把网页架设在谷歌云,也顺便研究了如何把网页架设在自家的网络附加储存群晖上。

因为要架设的是wordpress,所以在群晖NAS里就要安装web station, maria db5 或db10,PHP及phpmyadmin。直接在群晖里安装wordpress,或手动把wordpress抄写进群晖都没差。如果在群辉里安装wordpress,那群晖就自动生成wordpress子目录。手动抄写的话可以任意命名子目录。

  1. 如果要把域名投射向群晖的话,那就要用到ddns。在域名的设置里,先创建CNAME record比较意外的是原来target可以投向ddns地址。
  2. 从ddns投射来会自动进到群晖web目录下。要把域名直接投射到子目录就要在群晖web station/virtual host里,把域名设置投向子目录。
  3. 群晖的virtual host有些怪异点。第一如果mysql用maria db5的话,在wp-config(或wordpress初始设置)里须把  /** MySQL hostname */设置成 localhostlocalhost:3306 。但是mysql用maria db 10的话,那就要用 127.0.0.1:3307 虽然localhost或127.0.0.1都是指向同样目的地,可是弄错了网页就没法上线了。
  4. 这时候wordpress里可能没能直接保存permalink。系统会要求手动把生成的文件抄进.htaccess里。如果要系统自动保存文件,就要提供系统权限。
      • 在群晖control panel/user里,确定admin或user有admin权
      • 在control panel/telnet里打开SSH。
      • 用putty进入群晖,用拥有admin权的admin/user进入,输入密码,然后执行以下指令
      • sudo su(获取根目录权限)
      • 键入密码
      • chown -R http:http /volume1/web/myfoldername(更换所有权)
      • chmod -R 775 /volume1/web/myfoldername(提供执行权)。

TP Link C3150退款

纷纷扰扰了一阵,终于都获得退款了。从18年2月14日购买TP Link C2300起,一对一在销售点换过一次C2300。过后发现问题还是没解决,到TP Link保固处升级成C3150。噩梦开始。

5Ghz wifi自然消失的问题始终没有解决。虽然如此,这router就搁在哪儿,然后把D Link的switch送保固。纵是如此还是没能解决问题。折衷方法是把switch收起来不用。有一阵子还打算买过新的switch。直到unifi宽频提升到800mbps,发现这router无法达到顶速,就坚持TP Link退款。

起初TP Link检查后,通过电话告知没问题。 不过TP Link要求把D Link的switch一并拿来检查。 第二次回到那里把D Link 的switch交给他们。
同样的TP Link的测试依旧是否定的。第三次回去的时候,即场检查也看不出任何问题。不过他们已经把固件降回旧版以解决宽频无法达到顶峰值的问题。

把router及switch带回来后,除了宽频速度改善外,5Ghz wifi还是一样没改变,开了D Link switch后, TP Link 的wifi过不久就无影踪了。

所幸这次TP Link客服提出让中国方面的客服看一看问题在哪儿。好不容易等到星期六,偏偏wifi 从下午2点等到晚上8点才掉线。又要等到隔天。星期天早上11时发现问题复发即刻致电TP Link客服。这wifi还真夭寿,胆敢在通话当儿恢复正常。又等了2小时,wifi问题才又复发。最后的最后终于都让中国客服连上电脑检查。经过中国TP Link人员远程检查,发现问题在于5GHz高频段与D Link相冲,只有低频段可以正常操作。整个过程不会超过15分钟,似乎对方早已知道问题在哪里。

妖兽,万恶的5Ghz高频段。

这个地方来去了几次!希望不会再为router保固问题再回来。再见!

18年6月29日加钱升级成C3150。

19年3月1日,痛苦都到了尽头。前后历时一年。

修改Google cloud文件权限

处理谷歌云上的文件会碰到伺服器不让修改文件的问题。要解决这问题有几个步骤要做。

第一是从谷歌云平台(google cloud platform)里找要修改文件的电脑。在哪里由SSH进入谷歌云电脑。

打入以下指令检查原文件权限。

stat -c “%a %n” /文件路径

下一行指令会显示原文件权限。接着就键入以下以修改文件权限。

sudo chmod 777 /文件路径

777是文件所有权限都放行。电脑接下来没显示任何回应。可以再键入
stat -c “%a %n” /文件路径 来重查文件权限。没意外的话文件权限已经修改。下一步重启Apache服务器。如果是bitnami配套的话,指令如下。

sudo /opt/bitnami/ctlscript.sh restart apache

这时候重写服务文件已经无障碍。

Hosting WordPress on google cloud

There are few steps involved in the hosting of wordpress on google cloud.

  1. Create an instance with WordPress installed
  2. Point domain to google cloud server
  3. Upload files to google cloud
  4. Upload and replace existing MySql file in phpMyAdmin

1.Create an instance with WordPress installed

This is relatively straight forward. First create an account with google cloud. Once completed, there are 2 ways to create the server, or so call instance. We can create an empty instance and install WordPress later. However, the much simpler way would be to create an instance with WordPress installed. To do this, inside google cloud, click the hamburger icon, look for deployment manager. From there look for WordPress installation. There are few WordPress version to choose from. The decision would be on the price and the associate installation packages.

Once decided the installation package, we need to specify the CPU, memory, disk size, network etc. The whole installation would take about few minutes to complete.

At the end of the installation, there would be information about the instance, e.g., ip address, username, password etc.

2. Point domain to google cloud server

There are two ways to do this. For the first method, it involves two servers, namely google and domain name provider server. First go to the google console, inside API and services, look for google cloud DNS API and enable it. Then return to the console, under network services/cloud DNS, start to create zone. Fill in A record and CNAME once the zone created.

The subsequent steps would be done on the domain name provider server.
Copy the name servers provided in google DNS zone and fill inside domain name provider server.

For the second method, nothing needed to be done on the google console and no need to enable google cloud DNS API. The domain name could be propagated to google cloud server from domain name provider directly. For this method, use default name server provided by the domain name provider, then start to add record in DNS management page.

3. Upload files to google cloud

To upload the file we need a ftp client. Here we use Fileziella. As there is no username and password provided to connect to google cloud server, we have to create one using PuTTY Key Generator.

Inside Putty Key Generator, click Generate. Copy the public key and save the private key. Inside Google cloud platform, find the project/instance, metadata/SSH keys. Click edit and paste the public key into the box provided and save.

Open Fileziella and fill in 1, 2, 3. Fill the server IP address in 1. For 2, this is key comment from PuTTY Key Generator. For 3, browse and load the saved private key. Click connect and start to upload files.

4. Upload and replace existing MySql file in phpMyAdmin

As it is difficult to create a new database with database name, username, password, it is better to import own database content to the existing database via phpMyadmin. However there is a catch here. The server phpMyAdmin won’t allow direct remote connection. phpMyAdmin must be opened from the local host, i.e., 127.0.0.1.

To do this, we need to create a SSH tunnel between remote computer and the server. Here we use PuTTY .

  • Fill in the server IP in 1.
  • Browse and load private key generated from PuTTY Key Generator in 2.
  • Enter 8888 for source port and localhost:80 for destination. If http is redirected to https, use 443 for destination port.
  • Enter key comment from PuTTY Key Generator in Auto-login username.
  • Go back to session and click open. This will create a secure tunnel between source 8888 and destination 80 ports.
  • Open a browser, enter http://127.0.0.1:8888/phpmyadmin
  • In the phpMyAdmin interface, use root for username and password from google instance[ Admin password (Temporary)] for password.
  • Inside phpMyAdmin, look for the database. For bitnami installation, the database name looks like bitnami_wordpress”
  • Select bitnami_wordpress, drop existing data and import own data to this database.
  • Under database prefix_options, change the site url and home as needed.
  • Last, search for wp-config.php inside the server. Change the database table prefix as necessary.

By now the website should be live.