The process is quite simple once you know the trick 🙂

  1. Make a copy of the web site folder structure
  2. Create yourself another folder at the root with the name of your Dev site
  3. Paste the content of the Live one we made into that new folder
  4. Make an export of the MySQL Database in SQL format, i love using “HeidiSQL” it’s easy and friendly use,
  5. Open the SQL file with a Text editor and locate those 2 lines :
    1. CREATE DATABASE IF NOT EXISTS `wp_DATABASENAME` /*!40100 DEFAULT CHARACTER SET utf8 */;
    2. USE `wp_DATABASENAME`
  6. Replace the value between the quote by the name of the new staging database
  7. In your favorite MySQL manager, create a new database with the same name with new credential as well
  8. Inject the SQL Script in the new Database
  9. In the new folder , locate the file wp_config.php and open it with your favorite text editor
  10. Modify the file to reflect the new credential and database name you’ve setup
  11. Back into your favorite MySQL manager, run the following Query to update the URL of the wordpress installation

update wp_options
set option_value = REPLACE(option_value,'myliveurl.mydomain.com','mystaging.mydomain.com')
where option_value like '%myliveurl.mydomain.com%'

Tagged with:  

ALTER DATABASE YourDatabase DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

Tagged with:  

First we need to have access to MySQL server , then with the query analyzer we have to pass the following 3 query, dont forget to change “DATABASENAME” to your database and the info in the “VALUE” section to adap to your need !

1.

INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES (‘4’, ‘demo’, MD5(‘demo’), ‘Your Name’, ‘test@yourdomain.com’, ‘http://www.test.com/’, ‘2011-06-07 00:00:00’, ”, ‘0’, ‘Your Name’);

2.

INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4','wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

3.

INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4','wp_user_level', '10');

Ref : http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/

Tagged with:  

How to install Mysql on Ubuntu Server

On 22 April 2015, in Mysql, Ubuntu, by Himselff
  • sudo apt-get install mysql-server
  • mysql -uroot -p
    • Enter the password
  • grant all on *.* to “root”@”%” identified by “ThePasswordHere” with grant option;
  • exit
  • sudo nano /etc/mysql/my.cnf
  • Modify the line where it says listen to 127.0.0.1 , with your IP
Tagged with:  

MySQL Query to extract database size

On 11 December 2013, in IT Procedure, Mysql, Programming, by Himselff
SELECT table_schema , sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ;
Tagged with:  
  • grant all on *.* to ‘root’@’%’ identified by ‘PasswordHere’ with grant option;
Tagged with:  

How to connect to Mysql server with command line

On 3 September 2013, in Mysql, by Himselff
  • mysql –server=serverIP –user=monuser –password=monpassword
Tagged with:  

How to reset root password on mysql server

On 26 April 2011, in Mysql, by Himselff

1. Stop MySQL services

2.  Start them back in safe mode (mysqld_safe –skip-grant-tables &)

3. mysql -u root mysql

4. At the prompt, run the following command, changing abcd by your new password :

UPDATE user SET password=PASSWORD(“abcd”) WHERE user=”root”;
FLUSH PRIVILEGES;

5. There you go , just enter that command to test, it will prompt for the password :

mysql -uroot -p

Tagged with:  

How to install Mysql server on Fedora

On 19 April 2011, in Fedora, Linux, Mysql, by Himselff

In terminal :

1. yum install mysql mysql-server (launch the install)

2. chkconfig mysqld on (Make the deamon start at boot)

3. service mysqld start (launch the deamon)

4. mysqladmin -u root password ‘new-password’ (Setting the root password, don’t forger the quote)

Tagged with: