Category Archives: Mini Howto

Connecting to Database via MySQL Workbench

You will need to open a Support Ticket with M3 Server.
CLICK HERE to open ticket.

M3 Server will need your IP.
CLICK HERE and you will be provided with your IP.
Note: We need the IP that our site reports so it can be whitelisted. IP should be static, not dynamic, or security will be weakened.

Once your IP has been whitelisted use these steps as follows:

1. Open MySQL Workbench

2. Click the Add icon

Screen Shot 2014-07-03 at 11.20.31 AM

3. Enter a connection name

Screen Shot 2014-07-03 at 11.36.56 AM

4. Select Standard (TCP/IP) as the connection method

5. Click the Advanced tab

Screen Shot 2014-07-03 at 11.39.07 AM

6. Check the box Use the old authentication protocol.

Screen Shot 2014-07-03 at 11.41.05 AM

7.  Clich the Parameters tab

Screen Shot 2014-07-03 at 11.41.56 AM

8. Fill in this information accordingly.

Screen Shot 2014-07-03 at 11.46.54 AM
Hostname yourserver.m3xs.net
Port 3306
Username Database Username
Password: Database Password

9.  Click store in keychain and you will be prompted to enter Database Password

Screen Shot 2014-07-03 at 11.46.34 AM

10. Click OK and you should now be able to connect to your Database

NOTE:
Using MySQL client from the command line, may give you the result:

Warning: Using a password on the command line interface can be insecure.
ERROR 2049 (HY000): Connection using old (pre-4.1.1) authentication protocol refused (client option ‘secure_auth’ enabled)

To bypass this, use the command line option:
–skip-secure-auth

The command line option will then resemble the following:
mysql –skip-secure-auth -u’yourdbusername’ -p’yourpassword’ -h v2505.m3xs.net

set timezone per site

Advanced method, use php:
php.net manualtimezone

Easy method, use htaccess.
Objective: Set tiemzone

Scenarios:

  • How to use a different timezone per site
  • Set your site to work in your timezone VS the local server time

WARNING. Improper use of htaccess or simple typo can render your site broken / inoperable. Don’t scream at your neighbor if you forget to make a backup of your file. Then, if things go wrong, you can just upload your original .htaccess file to the server. Backups are important, you have been politely warned.

Place this code at the top of your htaccess file:

php_value date.timezone "Europe/Istanbul"

Create Database backup with phpmyadmin

Creating a backup of your database is very important.  Besides having a safe and updated copy of your database, its also wise to do so before upgrading wordpress or any other major changes.  While there are a few methods for doing so, this how to will cover the topic of phpmyadmin.  PhpMyAdmin is a tool to manage your database, it can also be used to export your database to a backup file for safe keeping.

1) login to your phpmyadmin URL.  What is your URL?  It will look something like this, just use your server name instead of example:

https://SERVER_NAME.SOME_HOST.net/phpmyadmin/

The user name and password is of the database you wish to manage.  If you don’t remember it, just look inside your php config file for the settings.  The php config file for wordpress is, wp-config.php.

2) Once logged in, you will notice a row of tabs on the top.

first

Click on the Export tab and follow the steps:

  1. Select only your database, not al
  2. l.Screen Shot 2013-08-28 at 9.46.21 AM
  3. Ensure SQL is selected under Export section
  4. If your database is large, I suggest you use one of the Compression options.
  5. Ensure the box is checked “Safe as file”
  6. Screen Shot 2013-08-28 at 9.48.00 AM
  7. Enter the db name in the “File name template” box.
  8. click Go (bottom right)
  9. Depending on your browser or operating system, your file will be downloaded into the browsers default location, or you may be prompted to save as.

Enjoy your backup!

Note:  If you have other databases, you will need to log out of phpmyadmin, then log back in with the other database user name and password.  Repeat this for each database that you have.

You don’t ever have to import your database (restore) unless your current database breaks or is corrupt.

If you have many databases, please contact support and we can script this backup process for you.  You can then download them via FTP at your leisure.

Mini Howto: Create a database backup with phpmyadmin

Creating a backup of your database is very important.  Besides having a safe and updated copy of your database, its also wise to do so before upgrading wordpress or any other major changes.  While there are a few methods for doing so, this how to will cover the topic of phpmyadmin.  PhpMyAdmin is a tool to manage your database, it can also be used to export your database to a backup file for safe keeping.

1) login to your phpmyadmin URL.  What is your URL?  It will look something like this, just use your server name instead of example:

https://SERVER_NAME.SOME_HOST.net/phpmyadmin/

The user name and password is of the database you wish to manage.  If you don’t remember it, just look inside your php config file for the settings.  The php config file for wordpress is, wp-config.php.

2) Once logged in, you will notice a row of tabs on the top.  Click on the Export tab and follow the steps:

  1. Select only your database, not all.
  2. Ensure SQL is selected under Export section
  3. If your database is large, I suggest you use one of the Compression options.
  4. Ensure the box is checked “Safe as file”
  5. Enter the db name in the “File name template” box.
  6. click Go (bottom right)
  7. Depending on your browser or operating system, your file will be downloaded into the browsers default location, or you may be prompted to save as.

Enjoy your backup!

Note:  If you have other databases, you will need to log out of phpmyadmin, then log back in with the other database user name and password.  Repeat this for each database that you have.

You don’t ever have to import your database (restore) unless your current database breaks or is corrupt.

If you have many databases, please contact support and we can script this backup process for you.  You can then download them via FTP at your leisure.

M3Server.com – Empower.Your.Site

restrict access and authenticate login

Overview: To restrict access to a private directory with both IP address restriction and a login and password.

Setup: htaccess and Apache, on M3′s linux hosting.
Objective: Provide authentication and restrict access based on IP address.

WARNING:  Backup up your current .htaccess file first if you have one.  If this procedure produces unwanted results, simply remove the code or rename the file .htaccess to .off.htaccess to disable it.

Change the login example to your own user name and use relevant IP’s to your organisation.  The following is an example.

### Copy Below this line ###

AuthUserFile /home/ftpuser/domain.com/admin/.htpasswd

AuthGroupFile /dev/null
AuthName “IP & Login Required”
AuthType Basic

require valid-user

<FilesMatch \.(?i:gif|jpe?g|png|htm|html|php)$>
Order deny,allow
Deny from all
Allow from 192.168.1
</FilesMatch>

## Copy above this line ###

Copy and paste the above example into your .htaccess file, or create one and upload it to your site’s private directory.

Changes take effect instantly.

This configuration requires the basic understanding of htaccess and how to create a passwd file.  That is reserved for another blog post :)

We hope you found this support blog useful.

- M3server – world.class.hosting

Mini Howto: Preview site on new server before updating dns

Senario:

You have a live site elsewhere that you are moving to M3 (thanks!), but want to see how the site looks before updating dns?  No problem!

Edit your computer’s host file!

windows path:

C:\WINNT\system32\drivers\etc\hosts

Windows Command:

for windows Vista and Windows 7
Click Start – search for “Notepad“, right-click and select “Run as Administrator“. This should launch notepad with elevated privileges. Now, open the host file from the File menu, edit and save.

Mac OS X and most Linux Operating system’s path:

/etc/hosts

MAC/LINUX COMMAND:

Launch terminal:  click on applications > utilities > terminal

sudo nano /etc/hosts

Open the hosts file with notepad, nano, vi, or any other plain text editor (not word or wordpad).

Revise the example below with your correct information and enter this line on the bottom of your hosts file:
216.177.153.2  www.your_site.com your_site.com alias_names.com other_site2.com www.other_site2.com

The above line is not meant to line wrap, it is all on one line – very important.

IMPORTANT Do not add your test IP to more than one line. If you have 100s of domains that you want to test, they all need to be listed on a single line. Otherwise, the IP at the bottom of the list will over rule the entries for that IP above it.

NOTE: the above IP address and web site are an example only. Enter your site’s new IP address and your domain name(s) in place of the provided example. If you don’t know the IP of your server, you can find the list of IPs and domain names in your M3Admin Server Control Panel.

Make sure there is a tab or a space between the ip and the domain name, and a space between each domain name.  Save the file.  Restart your browser, and you will now see the site on your server.  Quick and simple.  I make a shortcut of my hosts file on my desktop as I do this often.

Restart your browser, you can now view your site on the new server for testing before updating the DNS servers at your domain registrars. Sometime’s browsers will be stubborn about caching your domain name to the old ip. To make certain, upload a test file or a file that you know has changed on the new server and verify it displays accurately in your browser.

- M3Server.com managed virtual servers

Mini Howto: 404 error pages using htaccess

Instead of the default 404, you can customize this page to regain some lost traffic.

In your domain’s root directory where your main index page is, add this line to the top of your .htaccess file:

ErrorDocument 404 /index.html

Instead of index.html, use whatever you have named your index page.  Many options are available here.  You can create a page, named for example, 404.html.  Then, you could populate that page with links or other information for your users.  Then, use that page in the htaccess directive above.

What is htaccess?  It is a file of directives for apache to process for your particular site.  The file is actually named .htaccess (the dot in front prevents users from reading your htaccess file directives and content via a web browser.

-M3Server.com

keywords: 404 custom error pages redirect file not found htaccess