To see data from one column, it is enough to execute the SQL query (where “abcd” is the name of the column in the table): To export to a file, just run the command in Linux: Here is an example of exporting email addresses from a mysql table to an http page using PHP. The […]
In this article I will give examples of some SQL queries for the base of the ABillS billing system.
To change the WordPress theme via MySQL, first see what theme is specified at the moment, for this, execute the SQL query via phpMyAdmin or MySQL client: Next, see what themes are in the /wp-content/themes/ directory. For example, to change to the standard Twenty Fifteen theme, let’s execute three SQL queries:
To disable all WordPress plugins via MySQL, you must: 1) Be sure to make a backup copy of the database. 2) Open the phpMyAdmin or MySQL client from the terminal: 3) Execute the SQL query (if necessary, specify the correct prefix wp_): After that, all plug-ins will be disabled and you can activate them again […]
I will write some useful examples of sql queries for the Zabbix database: Search for a host by name: Find the data items of the specified host: Find the history of the values for the specified data item: Delete the whole history of the data element until 01.11.2014 (the time is specified in Unix format, […]
It was necessary recently to write a script that executes a sql query into the MySQL database. Example content: In order for the script to run automatically, open the crontab file in any text editor (in the nano editor CTRL+X for the output and y/n for saving or canceling the changes): Add the following line […]
Here are some examples of SQL queries for a WordPress database, where ‘TEXT’ provide your data.
Here is an example of changing the MySQL encoding of a database and tables. Before any actions on important data it is necessary to make a backup copy, for example: For the test, we will connect to MySQL and create a couple of new databases without specifying the encoding and specifying: Create a test table […]
To create a user, we first connect to the MySQL server console: Let’s see what users are: Create a user (where localhost is specified from where the user can connect, you can specify the IP address, localhost – from the local machine where the MySQL server itself, or % from any addresses): If you intend […]
I noticed once when importing a sql file the following error: ERROR 1067 (42000) at line 211: Invalid default value for ‘blablabla’ It arises because new versions of MySQL server use strict mode and parameters such as NO_ZERO_DATE do not allow entering date values like ‘0000-00-00’ into the database. Connect to mysql server: Execute a […]