Install Wordpress with SQLite

From Mjbmr
Jump to: navigation, search

I'm gonna show you how to install Wordpress with SQLite, first of all you need to get a fresh wordpress package, you can always get the latest version from svn repository, like this: svn co http://core.svn.wordpress.org/trunk/ blog, then get pdo for wordpress packages with some changes to make it work with latest version of wordpress from this link, unpack it to your wp-content directory, edit db.php inside your wp-content directory, replace this lines:

  1. if (defined('WP_CONTENT_DIR')){
  2. 	define ("PDODIR", WP_CONTENT_DIR .'/pdo/');
  3. 	define ('FQDBDIR', WP_CONTENT_DIR .'/database/');
  4. } else {
  5. 	define ("PDODIR", ABSPATH.'/wp-content/pdo/');
  6. 	define ('FQDBDIR', ABSPATH .'/wp-content/database/');
  7. }
  8. define ('FQDB', FQDBDIR .'MyBlog.sqlite');

with something like this:

  1. if (defined('WP_CONTENT_DIR')){
  2. 	define ("PDODIR", WP_CONTENT_DIR .'/pdo/');
  3. } else {
  4. 	define ("PDODIR", ABSPATH.'/wp-content/pdo/');
  5. }
  6. define ('FQDBDIR', '/path/to/your/database/');
  7. define ('FQDB', FQDBDIR .'database.sqlite');

Make a copy of wp-config-sample.php with new name wp-config.php add define('DB_TYPE', 'sqlite'); after define('DB_COLLATE', ''); then also add your keys which you can get random ones from https://api.wordpress.org/secret-key/1.1/salt/, then create tables using following command: wget -O - http://mjbmr.com/download/wordpress_sqlite.sql | sqlite3 /path/to/your/database/database.sqlite and finally run sqlite3 /path/to/your/database/database.sqlite add run insert commands like these:

  1. INSERT INTO wp_users (ID,user_login,user_pass,user_nicename,user_email,user_url,user_registered,user_activation_key,user_status,display_name) VALUES (1,'admin','password','admin','user@domain.com','',CURRENT_TIMESTAMP,'',0,'admin');
  2. INSERT INTO wp_usermeta (user_id,meta_key,meta_value) VALUES (1,'wp_user_level','10');
  3. INSERT INTO wp_usermeta (user_id,meta_key,meta_value) VALUES (1,'wp_capabilities','a:1:{s:13:"administrator";b:1;}');
  4. INSERT INTO wp_options (option_id,option_name,option_value,autoload) VALUES (1,'siteurl','http://domain.com/blog','yes');
  5. INSERT INTO wp_options (option_id,option_name,option_value,autoload) VALUES (2,'blogname','My Wordpress Blog','yes');
  6. INSERT INTO wp_options (option_id,option_name,option_value,autoload) VALUES (3,'blogdescription','Another SQLite Wordpress!','yes');
  7. INSERT INTO wp_options (option_id,option_name,option_value,autoload) VALUES (4,'users_can_register','0','yes');
  8. INSERT INTO wp_options (option_id,option_name,option_value,autoload) VALUES (5,'admin_email','user@domain.com','yes');

Then open wp-admin in yor browser and click on Update WordPress Database then use password recovery to set new password, good luck!