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

Error:

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

Example:

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

or

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: https://docs.modx.com/3.x/en/building-sites/client-proofing/security/troubleshooting-security/resetting-a-user-password-manuallyRead 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: https://docs.joomla.org/How_do_you_recover_or_reset_your_admin_password%3FRead 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

mysql

Reset your root password

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

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:

username@server1 [~]# cd ~/public_html

Create backup of your database:

username@server1 [~/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

username@server1 [~/public_html]# wp search-replace 'OLDdomain.com'
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

How to run shell commands from the inside MySQL command line

You need to use \! before shell command

Examples:

MariaDB [(none)]> \! date;
Sun Sep  9 03:18:38 CEST 2018
MariaDB [(none)]> \! ls -d public_html;
public_html
MariaDB [(none)]> \! touch 1.txt
MariaDB [(none)]> \! ls 1.txt
1.txt
MariaDB [(none)]> \! uptime;
 03:19:40 up 8 days, 11:45,  8 users,  load average: 4.92, 5.07, 4.89
MariaDB [(none)]> 
Read the rest

How to fix innodb_table_stats and innodb_index_stats has length mismatch

To fix annoying warnings like:

[Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name table_name.  Please run mysql_upgrade
 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name.  Please run mysql_upgrade

Just go ahead and run mysql_upgrade.… Read the rest