Recovery your wordpress password if you forgot it.

$ mysql -u root -p
mysql> use wpdb
mysql> update wp_users set user_pass=MD5('ucLinux1!') where wp_users.user_login='errong.leng';
mysql> flush preligage;
mysql> quit

PS:
wpdb is the database name in  wp-config.php
wp-config.php
define('DB_NAME', 'wpdb');
please refer to your case.

errong.leng is the user name, please refer to your case too.
ucLinux1! is the new password, please modify to your own password.
Must call flush preligage; otherwise you have to restart your mysql service.

define('DB_NAME', 'wpdb');

How to recovery mysql root password if you forgot it.

One of the recovery methods for a .MySQL passwordIf you forget the MySQL root password, you can use the following methods to re-set:1. Switch to rootSu root2. KILL out of the system in the MySQL process;Killall -TERM mysqld3. Start MySQL with the following command to start without checking the permissions;Safe_mysqld --skip-grant-tables &4. Then use the empty password to use the root user login to MySQL;Mysql -u root5. Modify the root user's password;Mysql> update mysql.user set authentication_string= PASSWORD ('123456') where User = 'root';Mysql> flush privileges;Mysql> quitRestart MySQL, you can use the new password login.Second, the MySQL password recovery method IIThere may be no system safe_mysqld procedures (ubuntu operating system, apt-get installed mysql), the following method can be restored1. Switch to rootSu root2. stop mysqld;
   
/etc/init.d/mysql stop3. Start MySQL with the following command to start without checking the permissions;Mysqld --skip-grant-tables &4. Then use the empty password to use the root user login to MySQL;Mysql -u root4. Modify the root user password 123456 (of course, you need to 123456 into the password you want to set);Mysql> update mysql.user set
authentication_string= PASSWORD ('123456') where User = 'root';Mysql> flush privileges;Mysql> quitReboot MySQL/etc/init.d/mysql restartYou can use the new password 123456 login.

Mysql have changed the column "password" to "
authentication_string"

Earn Free Credits via vagex on your GCE VMs

Free #Youtube Views #vagex http://vagex.com/?ref=399793

I chose ubuntu 16.04 as my disk image.

First create your VM instance.
Then install xfce desktop, vncser and firefox on it.
$ sudo apt-get update
$ sudo apt-get install xfce4 xfce4-goodies
$ sudo apt-get install firefox
$ sudo apt-get install tightvncserver
$ vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  file /home/errong_leng/.Xauthority does not exist

New 'X' desktop is vvs:1

Creating default startup script /home/errong_leng/.vnc/xstartup
Starting applications specified in /home/errong_leng/.vnc/xstartup
Log file is /home/errong_leng/.vnc/vvs:1.log



Then let's setup Firefox viewer of vagex on your GCE VMs via VNCViewer.
I recorded a video via VNCViewer on my android phone.
Please check it for more detail.



OK, everything is done, just let it be, and vagex will give you credits every day.
Earn Free Credits #vagex http://vagex.com/?ref=399793

How to Setup tomcat on ubuntu

First, please setup JAVA on your ubuntu, you can refer to :
https://lengerrong.blogspot.com/2017/03/how-to-config-oracle-java-on-your-ubuntu.html


$ wget http://mirror.apache-kr.org/tomcat/tomcat-9/v9.0.0.M22/bin/apache-tomcat-9.0.0.M22.tar.gz
$ tar xzvf apache-tomcat-9.0.0.M22.tar.gz
$ sudo cp apache-tomcat-9.0.0.M22 /var/lib/tomcat9 -rf
$ cd /var/lib/tomcat9/
$ sudo vim bin/startup.sh
# Better OS/400 detection: see Bugzilla 31132
os400=false
case "`uname`" in
OS400*) os400=true;;
esac

export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
export JRE_HOME=/usr/lib/jvm/java-8-oracle/jre/
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH
export TOMCAT_HOME=/var/lib/tomcat9




Start tomcat
$ sudo bin/startup.sh


Setup your xfce desktop and vncserver for your VPS

First, let's install a desktop environment.
I chose xfce, something faster.
$ sudo apt-get install xfce4 xfce4-goodies


Second, let's install one vncserver.
$ sudo apt-get install tightvncserver

Let's configure vncserver.
Start the vncserver, and follow the directions to create a password

$ vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  file /home/errong_leng/.Xauthority does not exist

New 'X' desktop is vvs:1

Creating default startup script /home/errong_leng/.vnc/xstartup
Starting applications specified in /home/errong_leng/.vnc/xstartup
Log file is /home/errong_leng/.vnc/vvs:1.log

$ cat .vnc/vvs\:1.log
30/06/17 05:51:52 Xvnc version TightVNC-1.3.10
30/06/17 05:51:52 Copyright (C) 2000-2009 TightVNC Group
30/06/17 05:51:52 Copyright (C) 1999 AT&T Laboratories Cambridge
30/06/17 05:51:52 All Rights Reserved.
30/06/17 05:51:52 See http://www.tightvnc.com/ for information on TightVNC
30/06/17 05:51:52 Desktop name 'X' (vvs:1)
30/06/17 05:51:52 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
30/06/17 05:51:52 Listening for VNC connections on TCP port 5901
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
xrdb: No such file or directory
xrdb: can't open file '/home/errong_leng/.Xresources'

As you can see, the TCP port is 5901.
Since I use google cloud compute engine, I have to setup a new firewall rule for this.
Let's verify external IP listen on 5901.
$ nc 146.148.82.191 5901 
RFB 003.008

Great! Everything seems ready for our VNC client to connect.
Open your VNC viewer and connect to the IP of your Compute Engine instance on port 5901.





If still not work, try :
$ sudo iptables -F

Set up Guacamole on your VPS, then you can access your VPS from anywhere, all you need to access your desktops is a web browser.

Refers :
http://guacamole.incubator.apache.org/doc/gug/installing-guacamole.html
http://guacamole.incubator.apache.org/doc/0.9.1/gug/installing-guacamole.html

My VPS is ubuntu 16.04.

1. Buiding guacamole-server from source.

install required dependencies
$ sudo apt-get install libcairo2-dev libjpeg-turbo8-dev libpng12-dev libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev libfreerdp-dev libpango1.0-dev     libssh2-1-dev     libtelnet-dev libvncserver-dev libpulse-dev  libssl-dev libvorbis-dev libwebp-dev
$ sudo apt-get install autoconf libtool

setup jdk and mav
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ sudo update-java-alternatives -s java-8-oracle
$ export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
$ wget http://apache.tt.co.kr/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
$ tar xzvf apache-maven-3.5.0-bin.tar.gz
$ export PATH=~/apache-maven-3.5.0/bin:$PATH

setup tomcat too, please refer to:
http://lengerrong.blogspot.com/2017/06/how-to-setup-tomcat-on-ubuntu.html

build
$ git clone git://github.com/apache/incubator-guacamole-server.git
$ incubator-guacamole-server
$ autoreconf -fi
$ ./configure --with-init-dir=/etc/init.d
$ make
$ sudo make install
$ sudo ldconfig

At this point, everything is installed, but guacd is not running. You will need to run guacd in order to use Guacamole once the client components are installed as well.

2.Building guacamole-client from source too.
$ git clone git://github.com/apache/incubator-guacamole-client.git
$ cd incubator-guacamole-client
$ mvn package

[INFO] guacamole-common ................................... SUCCESS [ 31.031 s]
[INFO] guacamole-ext ...................................... SUCCESS [ 15.395 s]
[INFO] guacamole-common-js ................................ SUCCESS [ 19.751 s]
[INFO] guacamole .......................................... SUCCESS [02:06 min]
[INFO] guacamole-auth-cas ................................. SUCCESS [ 27.770 s]
[INFO] guacamole-auth-duo ................................. SUCCESS [ 18.470 s]
[INFO] guacamole-auth-header .............................. SUCCESS [  7.781 s]
[INFO] guacamole-auth-jdbc ................................ SUCCESS [  0.575 s]
[INFO] guacamole-auth-jdbc-base ........................... SUCCESS [ 19.919 s]
[INFO] guacamole-auth-jdbc-mysql .......................... SUCCESS [ 15.506 s]
[INFO] guacamole-auth-jdbc-postgresql ..................... SUCCESS [ 14.984 s]
[INFO] guacamole-auth-jdbc-dist ........................... SUCCESS [  6.495 s]
[INFO] guacamole-auth-ldap ................................ SUCCESS [ 13.026 s]
[INFO] guacamole-auth-noauth .............................. SUCCESS [  7.274 s]
[INFO] guacamole-example .................................. SUCCESS [  5.699 s]
[INFO] guacamole-playback-example ......................... SUCCESS [  2.777 s]
[INFO] guacamole-client ................................... SUCCESS [ 14.757 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS


By default, VNC support will be installed as a dependency of the guacamole package. If you want SSH or RDP support, you will need to install libguac-client-ssh0 or libguac-client-rdp0 manually:
# apt-get install libguac-client-ssh0 libguac-client-rdp0
 
3. Deploying Guacamole
$ sudo mkdir /etc/guacamole
$ sudo cp guacamole/doc/example/user-mapping.xml /etc/guacamole
$ cat /etc/guacamole/guacamole.properties 
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# Auth provider class (authenticates user/pass combination, needed if using the provided login screen)
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml
$ cp guacamole/target/guacamole-0.9.12-incubating.war 
/var/lib/tomcat9/webapps/guacamole.war
$ sudo mkdir /usr/lib/tomcat9/.guacamole/
$ ln -s /etc/guacamole/guacamole.properties /usr/lib/tomcat9/.guacamole/     
$ sudo vim /etc/guacamole/user-mapping.xml 
  uncomment below content: 
    <authorize username="USERNAME" password="PASSWORD">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5900</param>
        <param name="password">VNCPASS</param>
    </authorize> 
 USERNAME and PASSWORD are for used for login guacamole.
 VNCPASS are the password for vncserver. 
 please modify for your case.    <authorize username="errong.leng" password="ucLinux1">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5901</param>
        <param name="password">ucLinux1</param>
    </authorize> 



4. Start guacd and tocmat
$ sudo /etc/init.d/guacd restart
$ sudo /var/lib/tomcat9/bin/startup.sh

OK. everything is done.
let's access via web browser.
 
 
 
 sudo apt-get install guacamole-tomcat 
by the way, since I use google cloud compute engine.
And tomcat use 8080 as default port, so we have to add a new firewall policy.
 
 
Important : You have to setup vncserver on your VPS first, since guacamole does not include it.
please refer to :
https://lengerrong.blogspot.com/2017/06/setup-your-xfce-desktop-and-vncserver.html

After you login, your desktop will show in your browser.


 




How to fix compile error on VPS : virtual memory exhausted: Cannot allocate memory

The root cause is no swap on your vps.
Let's mkswap by ourself.

errong_leng@vvs:~$ sudo su -
root@vvs:~# umask 077
root@vvs:~# mkdir /usr/img/
root@vvs:~# dd if=/dev/zero of=/usr/img/swap bs=1024 count=2048000
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB, 2.0 GiB) copied, 54.9435 s, 38.2 MB/s
root@vvs:~#  mkswap /usr/img/swap      
Setting up swapspace version 1, size = 2 GiB (2097147904 bytes)
no label, UUID=c435f1d9-9b3a-40a8-8624-b7a09adca9d5
root@vvs:~# swapon /usr/img/swap

Once you do not need swap, you can delete it.
Since it will use about 2G of your vps disk.
#swapoff /usr/img/swap
#rm /usr/img -rf

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...