Thursday, November 17, 2016

mongodb install windows

mongodb install windows

Download the latest production release of MongoDB from the MongoDB downloads page.

Click on .msi file and follow the instructions.

mongo Db

To Start the Mongodb server

Open an Administrator command prompt. Press the Win key, type cmd.exe, and press Ctrl + Shift + Enter to run the Command Prompt as Administrator. Go to Mongo db installed directory.
sy: mongod --dbpath="path to db" --port=27017
 Example: mongod --dbpath=d:\mongodb\ --port=27017

mongod ------ Command
dbpath  --- specify the database storeing path
port --- port number default port (27017)




Connect to the Mongo Db server using command prompt

Using below command we will able to connect to mongo server from command prompt in windows

sy : mongo --port=27017
Example: "C:\Program Files\MongoDB\Server\3.2\bin\mongo.exe

Friday, November 4, 2016

MySQL to export and import an .sql file from command line

 
 

To Export & Import Mysql data using Command Line

To export

If it's an entire DB, then:
$ mysqldump -u [uname] -p[pass] db_name > db_backup.sql
If it's all DBs, then:
$ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql
If it's specific tables within a DB, then:
$ mysqldump -u [uname] -p[pass] db_name table1 table2 > table_backup.sql
You can even go as far as auto-compressing the output using gzip (if your DB is very big):
$ mysqldump -u [uname] -p[pass] db_name | gzip > db_backup.sql.gz
If you want to do this remotely and you have the access to the server in question, then the following would work (presuming the MySQL server is on port 3306):
$ mysqldump -P 3306 -h [ip_address] -u [uname] -p[pass] db_name > db_backup.sql

To import

Type the following command to import sql data file:
$ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql
In this example, import 'data.sql' file into 'blog' database using Anil as username:
$ mysql -u anil -p -h localhost blog < data.sql
If you have a dedicated database server, replace localhost hostname with with actual server name or IP address as follows:
$ mysql -u username -p -h 202.54.1.10 databasename < data.sql
OR use hostname such as mysql.cyberciti.biz
$ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql
If you do not know the database name or database name is included in sql dump you can try out something as follows:
$ mysql -u username -p -h 202.54.1.10 < data.sql

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           |
+------------+---------------------+

Tuesday, July 12, 2016

Website Payments Pro Payflow Edition


How do I set up Payflow Pro with PayPal Sandbox?



1.Log in to PayPal Manager.

2.Enter your Partner, Merchant Login, User (if applicable) and Password, and click Log In.




3.From the main navigation select Service Settings | Setup.


4.The third heading from the top titled PayPal Express Checkout you'll see PayPal Sandbox email address.  Enter your PayPal Sandbox Seller email into this field, scroll to the bottom of the page and click on Save.


Your Payflow Manager has now been synced with your PayPal Sandbox account and is ready to begin accepting Test/Sandbox transactions.

NOTE:  If you do not see the PayPal Express Checkout section on the Set Up page,
you will need to contact Merchant Technical Support and request that PayPal Express Checkout be added to your Payflow account for testing purposes. 

Please provide your PayPal Sandbox email address and your Payflow Merchant login 
when creating the ticket with Merchant Technical Support.

configure php 5.x apache 2.4 windows 7



httpd.conf Edit



Download php-5.6.23-Win32-VC11-x86.zip from http://windows.php.net/download/ . Extract the zip file to c:\php.


Edit Apache’s config file, c:\Apache\conf\httpd.conf and add the following lines to the bottom of the file.

Method 1

  • LoadModule php5_module "c:/php/php5apache2_4.dll"
  • AddHandler application/x-httpd-php .php
  • PHPIniDir "c:/php"
  • Set the environment variable append this text : "c:/php"
  • Find Directory index and add index.php add below line
    • "DirectoryIndex index.html index.php"


save the conf file. Restart your Apache server.

Method 2

In this method we Configuring Apache to Use PHP as CGI on Windows Systems. which best suitable for Higher versions of php like (above php5.3 on Apache 2.2). we will configure below steps.


1. Assuming that your Apache server is installed at C:\Apache2.2

2. Assuming that your PHP engine is installed at c:/php/

3. Use "notepad" to open C:\Apache2.2\conf\httpd.conf

4. Go to alias_module section and define a script directory call /php/ as:


...
   ScriptAlias /php/ "c:/php/"
5. Add an access control section for this directory as:


    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

6. Go to mime_module section and define a mime type as:


...  
    AddType application/x-httpd-php .php

7. At the root level below the LoadModule section, define an "Action" entry:

#LoadModule ssl_module modules/mod_ssl.so

Action application/x-httpd-php "/php/php-cgi.exe"
This "Action" entry tells Apache to run "php-cgi.exe" from the script directory "/php/" for any "application/x-httpd-php" mime files.

8. Restart your Apache server.

save the conf file. Restart your Apache server.

PHP INI Edit

Now we have to do a few edits to the php.ini file to tell it to load support for mysql and the location for the extensions. Since there is not a already set php.ini file we need to rename one of the two examples to php.ini.
Rename c:\php\php.ini-development to php.ini
Now let’s edit php.ini
Uncomment extension directory.
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext"

Uncomment mysql modules
extension=php_mysql.dll
extension=php_mysqli.dll

save the .ini file changes. Restart your Apache server.