using same mysql user with many databases

Well it’s really not good practise, but this depends on how you’re accessing the other databases. For example, I have a server that hosts 10+ different WordPress sites. I have two options for connecting to the databases: Use the root login in all my wp-config.php files as it’s easier Create a user and logins associated … Read more

Write mysql credentials in plugin

As long as you aren’t passing out the plugin and other people don’t have access to it, you should be fine. You might add something like the following to the top of the file just in case though: defined(‘ABSPATH’) or die(‘Access denied’); That will simply make sure that the file is loaded via wordpress (e.g. … Read more

Protect custom form from SQL injection

Yes, $wpdb->update is sufficient protection. You should not escape or prepare the data. From the documentation of wpdb: data (array) Data to update (in column => value pairs). Both $data columns and $data values should be “raw” (neither should be SQL escaped). This means that if you are using GET or POST data you may … Read more

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