Snippets Collections
# If your logged in to mysql (mysql -u root -p) you can create the database
CREATE DATABASE database_name;

# The user can be created with
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';

# This user also needs access to the database
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'localhost';

# To make the new access rights available you have to reload them
FLUSH PRIVILEGES;

WPDBNAME=`cat wp-config.php | grep DB_NAME | cut -d \' -f 4`
WPDBUSER=`cat wp-config.php | grep DB_USER | cut -d \' -f 4`
WPDBPASS=`cat wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`
Db::getInstance()->executeS("DELETE FROM product_images WHERE id_product NOT IN (" . join($allProductIds,',') . ")")
star

Fri Jun 11 2021 14:23:59 GMT+0000 (UTC)

#database #mysql
star

Mon Jun 07 2021 18:06:54 GMT+0000 (UTC) https://stackoverflow.com/questions/7586995/read-variables-from-wp-config-php

#wordpress #database #credentials #automate
star

Thu Aug 06 2020 13:55:46 GMT+0000 (UTC) https://stackoverflow.com/a/39816161/6942743

#sql #database #querying-data

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension