Need SQL query to find&replace image URL

If you don’t have WPCLI installed, but still have commandline access or access via PHPMyAdmin, run: UPDATE wp_posts SET post_content = REPLACE(post_content,'<old URL>’,'<new URL>’); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,'<old URL>’,'<new URL>’);

WP_Query with LIKE returns strange query

You can’t use LIKE to compare arrays. LIKE is used to check if a string matches, or partially matches, a value in the database. IN is used to check if a value in the database is in a given set of values. They are not interchangeable. The correct comparison to use in your case depends … Read more

SQL Database Lost

You should be able to restore the database by simply copying those files into the DB folder. (e.g., /var/lib/mysql/dbname). Typically there is a FRM file included as well.

SQL command to export post_content from wp_posts using phpMyAdmin

Use This Script <?php $servername = “localhost”; $username = YOUR_USER; $password = YOUR_PASSWORD; $dbname = YOUR_DB_NAME; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die(“Connection failed: ” . $conn->connect_error); } $a1 = ($_GET[‘id’]); $sql = “SELECT post_content FROM `wp_posts` where ID=’$a1′”; $result = $conn->query($sql); if ($result->num_rows > … Read more

cannot log in to the mysql server (wamp and wordpress)

The default Wamp user`s credentials are: username: root password: (empty, nothing, nada) If you already have a WordPress website previously created on your Wamp system, then go to /www/yourlocalsite/wp-config.php and check out the username and password you set. Here`s an example: /** MySQL database username */ define(‘DB_USER’, ‘root’); /** MySQL database password */ define(‘DB_PASSWORD’, ”); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)