Hot File

How to Installing and Using PHPMyAdmin with WordPress

View: 365    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: MySQL   Fields: Other

9 point/3 review File has been tested

In addition to offering a visual GUI for database operations, I also appreciate being able to run command line SQL operations via my browser without having to log in to the server via SSH.

Introduction

In addition to offering a visual GUI for database operations, I also appreciate being able to run command line SQL operations via my browser without having to log in to the server via SSH.

For example, some WiFi and mobile connections regularly terminate persistent SSH sessions, making database tasks problematic.

Getting started with PMA is fairly straightforward on Linux. I'll describe how to do so with Ubuntu 14.x at Digital Ocean. Log in to your server via SSH:

apt-get install phpmyadmin

You can use the default settings during installation or customize them to your liking.

On a typical WordPress installation, there aren't any direct ports to MySQL for a hacker to try to access. They might try to break in via SSH or try SQL injection attacks against WordPress, but they can't directly attack the database. Once you install PMA, anyone can run web-based attacks against it in order to gain control of your database, so care is warranted.

There are a few precautions I recommend when configuring PMA.

1. Use very strong passwords for all of your MySQL accounts, especially the root account. e.g. 25 characters for the root password.

2. Use different MySQL accounts and privileges for each WordPress site running on a single server. This way if one WordPress password is compromised, only one site's database is compromised.

3. Change the default URL used by PMA. This way people can't visithttp://yourblog.com/phpmyadmin. While this security by obscurity isn't a very effective technique, it does add some protection.

Add an alias to the apache.conf file:

nano /etc/phpmyadmin/apache.conf
Alias /myobscuredpma /usr/share/phpmyadmin

Reload apache:

service apache2 reload

Then, to access PMA, visit http://yourblog.com/myobscuredpma

If you need to modify your PHPMyAdmin password, you can edit the config-db.phphere:

nano /etc/phpmyadmin/config-db.php

4. Configure Web Authentication for the PMA Site. This will require that you enter an additional password to gain access to PMA, in addition to your database password, like this:

Apache User Access Restrictions

To configure Apache user restrictions, follow these steps:

Install htpasswd as part of apache2-utils:

apt-get install apache2-utils

Make a directory to store your passwords:

mkdir /etc/htpasswd

Add htaccess support for PMA: 

nano /etc/phpmyadmin/apache.conf

Add "AllowOverride All" below 

<Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php
        AllowOverride All

Configure your user authentication for PMA:

nano /usr/share/phpmyadmin/.htaccess
AuthType Basic
AuthName "Login Required for Access"
AuthUserFile /etc/htpasswd/.htpasswd
Require valid-user

Set your password:

htpasswd -c /etc/htpasswd/.htpasswd username

And, restart Apache:

service apache2 restart

Browse to your PMA site, and you'll be prompted for your username and password as shown above.

It's very important to remember that PMA allows you to directly manipulate the WordPress database; that means it's quite easy to break your WordPress site if you don't know what you're doing. It's especially unwise to apply database scripts from the web unless you understand them completely. Use PMA with great care.

Here are a few scenarios that may be helpful to you in ongoing WordPress administration:

Without PMA, I would sign in to my server via SSH. Log in to MySQL, and then run:

create database wordpress;
grant all privileges on wordpress.* TO "your-mysql-username"@"localhost" identified by "your-mysql-password";
flush privileges;

With PMA, you can run any command line query with the visual interface. Click the SQL tab and paste the MySQL database instructions above. Then click Go to create the database.

I use this a lot when creating new WordPress sites, just before running the WordPress web installer. 

Or, you can use the visual interface to create your database directly:

You can also add users and define privileges this way. Click on the privileges tab:

Click Add User, and define the privileges for the database that you wish:

For your typical WordPress database account, you'll want to check the boxes in the Data and Structure squares. 

It's a very good idea to backup your database before performing any of the tasks below. If something goes wrong, you'll be able to restore your WordPress site from the backup.

Using the PMA web interface, click on your WordPress database, click the Export tab and select Custom.

Enable "Add Drop Table / View / Procedure / Function / Event" statement:

When you click Go, PMA will download a backup of your entire database. If you're Apache PHP timeout settings aren't properly configured, some long file downloads may timeout and fail. You can adjust this in PHP.ini as I describe on my site.

WordPress doesn't have built-in features to help with search and replace when websites change or you need to adjust content across many posts.

With PMA, you can run a manual query to search and replace the text that you want to change (again, be very careful with write-based SQL commands on your WordPress database):

UPDATE wp_posts SET post_content = REPLACE (post_content, 'source text', 'replace with this text');

An alternative to using PMA and MySQL, is this handy Search and Replace plugin.

Often when you move a WordPress site to a new domain name or URL, it won't reflect the changes to your domain name throughout the site; even after changing the domains in the site settings. You can fix this in the database with PMA:

Again, you can use the SQL query box to update your site's database directly:

update wp_options set option_value = replace(option_value,'http://old_domain.com','http://new_domain.com');
update wp_postmeta set meta_value = replace(meta_value,'http://old_domain.com','http://new_domain.com');
update wp_posts set post_content = replace(post_content,'http://old_domain.com','http://new_domain.com');
update wp_posts set guid = replace(guid,'http://old_domain.com','http://new_domain.com');
update wp_posts set pinged = replace(pinged,'http://old_domain.com','http://new_domain.com');
update wp_comments set comment_content = replace(comment_content,'http://old_domain.com','http://new_domain.com');

Or, you can use the web interface. Browse to the database name, select each table, run a query and manually change the settings for each:

Click Edit and make your changes:

There are rare cases where WordPress' administrator passwords get changed, lost or corrupted. If you can access your database, you can use PMA to update your password right directly (do browse and verify which numeric id represents the current administrative user):

Update 'your_database'.'your_user' SET 'user_pass'=MD5('new-password') WHERE 'wp_users'.'ID'=1;

 

How to Installing and Using PHPMyAdmin with WordPress

How to Installing and Using PHPMyAdmin with WordPress Posted on 12-01-2016  In addition to offering a visual GUI for database operations, I also appreciate being able to run command line SQL operations via my browser without having to log in to the server via SSH. 3/10 365

Comment:

To comment you must be logged in members.

Files with category

  • SQL Query to Find Nth Highest Salary of Employee with java

    View: 329    Download: 0   Comment: 0   Author: none  

    SQL Query to Find Nth Highest Salary of Employee with java

    Category: MySQL
    Fields: Other

    0/0 review
    This is a very common interview question if you are going for the role at junior level. Most of the people learn it character by character, but few understand how this query works.

  • World OOP With PHP and MySQL

    View: 1089    Download: 0   Comment: 0   Author: none  

    World OOP With PHP and MySQL

    Category: MySQL
    Fields: Other

    0.32142857142857/14 review
    Setting up the skeleton of our class is fairly simple once we figure out exactly what we need.

  • How to Build a Newsletter System With PHP and MySQL

    View: 1395    Download: 0   Comment: 0   Author: none  

    How to Build a Newsletter System With PHP and MySQL

    Category: MySQL
    Fields: Other

    1.125/4 review
    When starting any project, I like to layout the folders before I start coding, so lets do that now.

  • Top 20+ MySQL Best Practices that can not be ignored

    View: 1024    Download: 0   Comment: 0   Author: none  

    Top 20+ MySQL Best Practices that can not be ignored

    Category: MySQL
    Fields: Other

    1.6666666666667/3 review
    Database operations often tend to be the main bottleneck for most web applications today.

  • Create a PHP/MySQL Powered Forum from Scratch

    View: 1243    Download: 0   Comment: 0   Author: none  

    Create a PHP/MySQL Powered Forum from Scratch

    Category: MySQL
    Fields: Other

    1.5/3 review
    In this tutorial, we're going to build a PHP/MySQL powered forum from scratch.

  • Triggers Introduction to MySQL

    View: 361    Download: 0   Comment: 0   Author: none  

    Triggers Introduction to MySQL

    Category: MySQL
    Fields: Other

    1.6666666666667/3 review
    I would guess, even armed with this knowledge, that a good many of you are not taking advantage of triggers with MySQL.

  • How to Stored Procedures in MySQL 5

    View: 361    Download: 0   Comment: 0   Author: none  

    How to Stored Procedures in MySQL 5

    Category: MySQL
    Fields: Other

    2.25/2 review
    MySQL 5 introduced a plethora of new features - stored procedures being one of the most significant. In this tutorial, we will focus on what they are, and how they can make your life easier.

  • The strength of the PDO and. MySQLi: Which Should You Use?

    View: 368    Download: 0   Comment: 0   Author: none  

    The strength of the PDO and. MySQLi: Which Should You Use?

    Category: MySQL
    Fields: Other

    1.5/3 review
    When accessing a database in PHP, we have two choices: MySQLi and PDO. So what should you know before choosing one?

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd