How to fix a login issue after WordPress Multisite split

The slave installation will lose users

wp user list

| ID | user_login | display_name | user_email | user_registered | roles |

And you won’t be able to create new admin user because you don’t have appropriate MySQL tables

wp user create admin [email protected]
Read the rest

How to enable Slow Query Log

Append into /etc/my.cnf the following:

slow_query_log = 1
slow-query_log_file = /var/log/mysql-slow.log
long_query_time = 2

Create /var/log/mysql-slow.log log file and set it as mysql user:

touch /var/log/mysql-slow.log
chown mysql:mysql /var/log/mysql-slow.log

Restart MySQL server:


Monitor the logs using mysqldumpslow command:

mysqldumpslow -a /var/log/mysql-slow.log
Read the rest

Mysqldump error: The user specified as a definer does not exist


mysqldump myuser_db > myuser_db.sql

mysqldump: Got error: 1449: “The user specified as a definer (‘user_db’@’localhost’) does not exist” when using LOCK TABLES

To pass this error try to use –single-transaction

mysqldump --single-transaction myuser_db > myuser_db.sql

Should be good now

Source: the rest

How to fix Unknown collation utf8mb4_unicode_520_ci error while importing data from an sql dump


ERROR 1273 (HY000) at line 849: Unknown collation: ‘utf8mb4_unicode_520_ci’

To fix simply replace utf8mb4_unicode_520_ci to utf8mb4_unicode_ci inside your SQL dump


sed -i 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' yoursqldumphere.sql


replace 'utf8mb4_unicode_520_ci' 'utf8mb4_unicode_ci' -- yoursqldumphere.sql
Read the rest

How to reset MODX admin password over MySQL cli

You need to run the following query inside your MySQL cli

UPDATE modx_users SET hash_class = 'hashing.modMD5', password = MD5('3f8c369a185a95cfd198e5e') WHERE username = 'admin';

Note, update mysql table prefix, password, username to yours.

Source: the rest

How to add new admin Joomla user via mysql command line

Update prefix to your own

INSERT INTO `js_users` (`name`, `username`, `password`, `params`, `registerDate`, `lastvisitDate`, `lastResetTime`) VALUES ('Administrator2', 'admin2', 'd2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199', '', NOW(), NOW(), NOW());

INSERT INTO `js_user_usergroup_map` (`user_id`,`group_id`) VALUES (LAST_INSERT_ID(),'8');

You now should be able to login your dashboard with the following credentials:

Username: admin2
Password: secret

You will have to reset these credentials once you logged in your dashboard as its not secure to have it


Source: the rest

How to reset MySQL root password

Stop MySQL server

service mysqld stop

Start in safe mode

mysqld_safe --skip-grant-tables &

Login mysql server


Reset your root password

UPDATE mysql.user SET Password=PASSWORD('strong-password-here') WHERE User='root';

Shutdown your mysql server

mysqladmin -u root -p shutdown

Start your mysql server again

service mysqld start
Read the rest

How to change WordPress main URL to new one

Using WP-CLI (preferred):

Enter folder where your WordPress is installed:

[email protected] [~]# cd ~/public_html

Create backup of your database:

[email protected] [~/public_html]# wp db export

The following command won’t do any change because of –dry-run key specified but show you tables and amount of replacement

[email protected] [~/public_html]# wp search-replace ''
Read the rest

How to enable/disable SSL for Prestashop via MySQL command line

Enter your database

mysql your_database;

Check the value

select * from ps_configuration where name like '%SSL_ENABLED%';

To enable

update ps_configuration set value = '1' where name = 'PS_SSL_ENABLED';
update ps_configuration set value = '1' where name = 'PS_SSL_ENABLED_EVERYWHERE';

To disable

update ps_configuration set value = '0' where name = 'PS_SSL_ENABLED';
update ps_configuration set value = '0' where name = 'PS_SSL_ENABLED_EVERYWHERE';

 … Read the rest