Categories
Mysql

How to obtain magento cloud db credentials on ssh?

Run following command over ssh to obtain the DB credentials.

echo $MAGENTO_CLOUD_RELATIONSHIPS |base64 --d |json_pp
Categories
Mysql

How to update Magento2 Customer password through Database?

Use following query to update the customer password in magento2.

UPDATE customer_entity SET password_hash = CONCAT(SHA2('xxxxxxxxNewPassword', 256),':xxxxxxxx:1') WHERE entity_id = customerid;

xxxxxxxx : replace with any of your alphanumeric string both places should use same.
entity_id: obtian customer id from magento url
Newpassword: alphanumeric value 9 in total

Categories
Mysql

How to update Vesta CP?

Run following commands to update Vesta CP

v-list-sys-vesta-updates
v-update-sys-vesta-all

Categories
Mysql

How to free disk space on Digital Ocean Droplet?

Run following command to free the space

sudo apt-get autoclean && \
sudo apt-get clean && \
sudo apt-get autoremove && \
sudo update-grub

It will remove all unused kernals.

Categories
Mysql

How to check ubuntu total used space?

Use following command to check total space in server
cd / && sudo du -h --max-depth=1 .

Categories
Mysql

How to Repair WordPress Database?

Add below line in the wp-config.php after database credentials.
define ('WP_ALLOW_REPAIR', 'true');

The next step is to visit the database repair page. You’ll find this at http://your-site.com/wp-admin/maint/repair.php.

You have two options there,
Repair the database & Repair and optimize the database
first option will just repair the datbase tables if there is any issue but better to run second option that will repari aswell optimize the tables for best performance.
You can run this url for twice to make sure the repair process is done.

Make sure you remove the code line in wp-config.php

Categories
Linux Mysql Unix

How to Use MYSQL with SSH over LINUX/UNIX

It is actually a great thing if you learn the way to use MYSQL over SSH. So writing down you few very useful commands.

Login to MYSQL Through Shell
So here are the different commands to log into MYSQL
-h [hostname e.g localhost,127.0.0.1,IP]
-u [db username or root]
-p [password]
-P [port e.g 3306, 3307, 3304]

# mysql -h hostname -u root -p
After entering this command it will ask you the user password. Input the password and then you can able to access it.

# mysql -h 127.0.0.1 -u root -pPassword databasename
With this command password and database already specified so will access the database directly or you can leave -p empty and can enter the password in second term.

# mysql -h hostname -u root -pPassword -P 3306 databasename
With this command port number mention incase its required.

MYSQL Useful Command-List
After successfully login there are many operations can be performed through MYSQL commands, sharing you some of the useful commands.

Create an MYSQL database
# mysql> create database databasename;

List Down all the databases
# mysql> show databases;

Drop/Delete an MYSQL database
# mysql> drop databasename;

Choose an MYSQL database
# mysql> use databasename;

See all the tables from the chosen database
# mysql> show tables;

Show all the data in a table
# mysql> SELECT * FROM tablename;

Show selected row with certain values of an ID column e.g “126”
# mysql> SELECT * FROM tablename WHERE ID = ‘126’;

Import/Export MYSQL Database
It is a pretty easy and fast way to handle large size database.

Export MYSQL db
# mysqldump -pPassword -u Username Databasename > Databasename.sql

Import MYSQL
# mysql pPassword -u Username Databasename < Databasename.sql