How to dump a Microsoft SQL Server database to a SQL script?

In SQL Server Management Studio right-click your database and select Tasks / Generate Scripts. Follow the wizard and you’ll get a script that recreates the data structure in the correct order according to foreign keys. On the wizard step titled “Set Scripting Options” choose “Advanced” and modify the “Types of data to script” option to … Read more

Can local WordPress installs share /wp-content/ folder and database?

For wp-content folder you need to add WP_CONTENT_DIR with path to this folder to each wp-config.php file of each your sites. All of these WP_CONTENT_DIR constants should have the same path to one folder. Read more about it here: http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content To share the same database, you just need to setup the same database settings in … Read more

mysqldump throws: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)

This is due to a new flag that is enabled by default in mysqldump 8. You can disable it by adding –column-statistics=0. The command will be something like: mysqldump –column-statistics=0 –host=<server> –user=<user> –password=<password> Check this link for more information. To disable column statistics by default, you can add [mysqldump] column-statistics=0 to a MySQL config file, … Read more

Using $wpdb | checking entered email against existing emails in db

You shouldn’t be using mysql_num_rows() or mysql_error() when dealing with $wpdb. Even if you weren’t, mysql_error() is for database errors, and an empty result set is not a database error. If you want to know if results were returned, simply check the count() of the results: $duplicateEmail = $wpdb->get_results($emailTest, OBJECT); if ( count( $duplicateEmail ) … Read more

Getting Error Trying to Create Table

From MySQL reference: Permitted characters in unquoted identifiers: ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) Extended: U+0080 .. U+FFFF Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP), except U+0000: ASCII: U+0001 .. U+007F Extended: U+0080 .. U+FFFF ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not … Read more

Connecting to a different database

But I would like to use my secondary database connection like a standard WordPress query, so that all of the query builder functions are available. Unless the other database is a WordPress database, with the exact same table structure, you can’t. The query builder functions in WordPress are designed and built only to work with … Read more

How to get a list of WordPress default database tables?

There is no programmatic way to get a list of default tables. WordPress does not store a list of them anywhere. The closest thing there is is wp_get_db_schema(). This function returns the raw SQL used to create the default tables, but as you can see from the source, it doesn’t derive it from another source, … Read more