Saturday, June 3, 2017

How to Reset Mysql root password

Forgot mysql root password ? No worries here is how I reset mine on by debian 9 Box.Usually it boils down to starting service
in safe mode & updating password & then restrating it normally.

Here are the steps


1) First Stop mysql service

       sudo service mysql stop

2) Start mysql in safe mode

        sudo mysqld_safe –skip-grant-tables

3) In Another Terminal login as root mysql user no password needed

         mysql -u root

4) Update your root password using SQL Query for that first switch to mysql database which stores login and password.

          use mysql;

 5) Update password

         update user set password=PASSWORD(‘your_password_goes_here’) where where User='root';

6) Ask Mysql to reload previlages to make changes take effect

        flush privileges;

7) Now time to test if change:

we made are working fine first exit from mysql command prompt by issuing  'exit'.also close the mysql running in safe mode by going to corresponding terminal  & pressing  "control + c" until it stops.

8) Lets start mysql in normal way using service dameon

          sudo service mysql start

Once service is up try to login through command line use password you just assigned.
                  mysql -u root -p

    it works !

Friday, June 2, 2017

Quick Notes OrientDb installation on Debian 9

1) Download OrientDb Community Edition for linux from official sites
           orientdb-community-2.2.21.tar.gz
2) Extract it
   tar -zxvf orientdb-community-2.2.21.tar.gz
3) Move to /opt dir
    mv ~/orientdb-community-2.2.21 /opt/orientdb
4) installation
    Inside  /opt/orientdb issue below command
       sudo bin/server.sh
   follow the installation instruction & note password set for administrative    
   user account “root”.
 4) create user & group for running  orientdb as service dameon
       sudo useradd -r orientdb -s /sbin/nologin.
5) give access rights to new user
     sudo chown -R orientdb:orientdb /opt/orientdb
6) configuration
      Inside /opt/orientdb/bin/server.sh 
      a) ORIENTDB memory options change below line
                       ORIENTDB_OPTS_MEMORY="-Xms2G -Xmx2G"
                       with ORIENTDB_OPTS_MEMORY="-Xms128m -Xmx256m"
7)   Inside /opt/orientdb/bin/orientdb.sh
    b) OrientDB installation directory set installation path & user
                       ORIENTDB_DIR="/opt/orientdb"
                   ORIENTDB_USER="orientdb"

8)  Orientdb comes with web based gui like phpmyadmin assign sufficient right to         
    its config file
    sudo chmod 640 /opt/orientdb/config/orientdb-server-config.xml
9)  Package come with service but you have to move it to respective os directory
     sudo cp /opt/orientdb/bin/orientdb.service /etc/systemd/system   
    Inside this newly copied service file new need to set our user & entrypoint for server
         Open /opt/orientdb/bin/orientdb.service and replace default values with  
    orientdb user & group & change entry point with location of server.sh as
    below
          [Service]
      User=orientdb
      Group=orientdb
      ExecStart=/opt/orientdb/bin/server.sh
10) Setup Dameon
            sudo systemctl daemon-reload
        sudo systemctl start orientdb
        sudo systemctl enable orientdb
        sudo systemctl status orientdb
11) Hit http://localhost:2480 to see oriendb studio a web based interface like phpmyadmin.
12) Orientdb  server uses ports 2424 for binary connections & 2480 for HTTP
    connections.you might need to open the 2480 port in firewall.
13) Commandline interface
            sudo /opt/orientdb/bin/console.sh
            connect remote:127.0.0.1 root yourpasword