Linux date command -s (–set) doesn’t work

When we use the date  command to change system DateTime:

date -s '2021-03-04 11:21:13'

to change system time, the system return 

Thu Mar  4 11:21:13 CST 2021

It looks like the time have already changed successfully, but run the date command again and found the time still the old.

The reason is most modern Linux system has ntp running by default, we can use timedatectl command to check

root@nbear:/opt/c# timedatectl
      Local time: Thu 2021-03-04 09:45:24 CST
  Universal time: Thu 2021-03-04 01:45:24 UTC
        RTC time: Thu 2021-03-04 01:45:24
       Time zone: Asia/Shanghai (CST, +0800)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

As we can see, the Network time is on, so if we want to change the system time manually, we should shut down the ntp by using the following command:

timedatectl set-ntp false

Then you can change the system time.

Posted in Linux | Tagged , | Leave a comment

Use Docker to deploy phpmyadmin

Docker is a very powerful tool to deploy application, no need to worry about the Operation System, docker app delivered with runtime, it means you don’t need prepare the runtime and dependencies and just load the docker images and run it as a container:

First, let’s search the phpmyadmin image from dockerhub,just run the following command:

docker search phpmyadmin
(base) root@iZj6chew62f61q6kwc6ogsZ:/home/wwwroot/tech.ipv6center.org/wp-includes/js# docker search phpmyadmin
NAME                              DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
phpmyadmin/phpmyadmin             A web interface for MySQL and MariaDB.          1106                                    [OK]
phpmyadmin                        phpMyAdmin - A web interface for MySQL and M…   136                 [OK]                
nazarpc/phpmyadmin                phpMyAdmin as Docker container, based on off…   61                                      [OK]
bitnami/phpmyadmin                Bitnami Docker Image for phpMyAdmin             22                                      [OK]

Then ,chose the first image and run the following command:

docker run --name phpmyadmin4 -d -e PMA_HOST=rm-desh38b2h3b7vo.mysql.rds.aliyuncs.com -p 13306:80 phpmyadmin/phpmyadmin
The paramters:
-e PMA_HOST specify the host you want to connect, here is the aliyun RDS mysql server
-p Port mapping, map the host 13306 to the container phpmyadmin4’s 80 port, you can just http://host:133306 got the phpmyadmin login page
 

Conclusion

Docker is easy to use, you just need run a command and we got the phpmyadmin for mysql.

Posted in Docker | Tagged , | Leave a comment