Tuesday, 14 November 2017

lspci Command on Linux

This command will identifying the hardware of the internal devices.

manivel ~ # lspci



   



This command will give the more information about a specific devices. Here -s means show only devices in selected slots and -v means verbose.

manivel ~ # lspci -s 02:00.0 -v



For more options

manivel ~ # lspci --help

manivel ~ # man lspci 

Wednesday, 1 November 2017

How to Set System-Wide Proxy on Ubuntu


Setting the system wide proxy through Environment Variables

Edit the file "/etc/environment" and add the following lines

manivel@manivel-admin:~$ sudo vim /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
http_proxy="http://username:password@manivel.com:80/"
https_proxy="https://username:password@manivel.com:80/"
ftp_proxy="ftp://username:password@manivel.com:80/"
socks_proxy="socks://manivel.com:80/"

Thursday, 12 October 2017

Mysql Command line cheat sheet

List of mysql commands


Connecting Mysql : mysql -u username -p  ( will prompt for password )

Show all databases : show databases;

Create a new database : create database database_name;

Select database: use database_name;

Show all tables : show tables;

Show table structure : describe table_name;

MySQL open database connections : show status like '%onn%';

 MySQL show processlist : show processlist;

Deleting tables : drop table table_name;

Deleting databases: drop database database_name;

Export a database dump : mysqldump -u username -p database_name > database_dump.sql

Import a database dump : mysql -u username -p database_name < database_dump.sql

Create a new user: create user 'username'@'localhost' identified by 'password'

List out the users : select user,password,host from mysql.user

Friday, 1 September 2017

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Today i have changed the mysql datadir directory default to new one

This is the steps which i followed to change


[root@testing-server~]# service mysqld stop
[root@testing-server~]# mkdir /wesites/mysql
[root@testing-server~]# cp -prvf /var/lib/mysql /websites/mysql/

[root@testing-server~]# vim /etc/my.cn
f

        datadir=/websites/mysql       
        socket=/websites/mysql/mysql.sock


[root@testing-server~]# service mysql start

After these steps mysql started but i can't able to login locally. i got the error instead of successful login





   
Solution :

I have added the following things on /etc/my.cnf file

[root@testing-server~]#  vim /etc/my.cnf


    [client]
    socket=/websites/mysql/mysql.sock



[root@testing-server~]# service mysql restart


Now i can able to login locally