Friday, August 12, 2016

Mysql Interview Questions



  • What are the different tables present in mysql

           ---Myisam, isam, innodb, heap, merge


  • Types of index in mysql 

           --unique index, index

  • How to create Indx

           --sy: CREATE  INDEX AUTHOR_INDEX ON tutorials_tbl (tutorial_author)


  • Table have multiple index which order query will follow



  • Explain keyword 

Thursday, August 11, 2016

Linux Commands


1. To remove files in current directory

rm -rf ./*


2.To change the file permissions

Why is Magento 1.4 including javascript files by filesystem path?
  
 chmod -R 777 var/ media/
-R --recusively
777 --- Full permissions to all users
var/media --- directory path


3. Add svn repositry in server

svn co  
 svn co https://acd.svn.beanstalkapp.com/ekr-tbp/trunk test2/


4. To start the apache server

service httpd start
service httpd stop

5. To see the error log

tail
tail -f  
cat  

6.To Rename the folde name
mv old-file-name  new-file-name

7. Zip the files on current directory
tar -cvf aws6-9-16.tar
tar -czf aws6-9-16.tar.gz . --exclude=./*.gz

mv testfile testfile2

8. To set number in vim editor
:set nu

9. To remove all content of  a file using vim editor
:1,$d
dgg
10. Download a file using curl
curl -OL http://pear.php.net/go-pear.phar

11. To unzip specific file on current directory
unzip agf-stage.zip -d .
. ---current directory
agf-stage.zip ---file name


Mysql adding user for remote access or workbench



In order to connect remotely you have to have MySQL bind port: 3306 to your machines IP in my.cnf. Then you have to have created the user in both localhost and '%' wildcard and grant permissions on all DB's as such . See below:


path : /etc/mysql/my.cnf

my.cnf
#Replace xxx with your IP Address 
bind-address        = xxx.xxx.xxx.xxx
Creating the user
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
And granting permissions to the user
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
FLUSH PRIVILEGES;

To get the user list and there permissions in mysql db
mysql> SELECT user, host FROM mysql.user;
+------------+---------------------+
| user       | host                |
+------------+---------------------+
| adadmin    | %                   |
| tbpmagento | %                   |
| wpuser_agf | %                   |
| root       | 127.0.0.1           |
| root       | ::1                 |
| ces        | localhost           |
| root       | localhost           |
| tbp        | localhost           |
| tbpmagento | localhost           |
+------------+---------------------+