Fix SQL Tips Web

How to Reset the Primary Key Sequence ID in PostgreSQL

I run into an issue today with PostgreSQL. I had manually entered a row into a table and it caused the primary key to fall out of sequence. To reset the primary key sequence ID on the PostgreSQL table I used the setval and pg_get_serial_sequence functions. Source: How to reset postgres’ primary key sequence when […]

Fix SQL Web

Fixing MySQL Error 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes

To fix, “MySQL Error 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes” on Ubuntu edit your /etc/mysql/mysql.conf.d/mysqld.cnf. Once you have opened the file, increase the max_allowed_packet to a value that works for your environment. For example, in a local development environment, 100M can work. Then restart MySQL. Resources

Performance SQL Web WordPress

How to Display and Debug All Database Queries Made by WordPress

When working with WordPress you will eventually have the question, “How do I display all database queries made by WordPress?” In your wp-config.php file add the following: By setting SAVEQUERIES to true the wpdb global instance will store all the database queirs you make; this will allow you to inspect the number of queires each […]

Fix Laravel Servers SQL Web

Disable MySQL Strict Mode and NO_ZERO_DATE Errors in Laravel Homestead

If you are using MySQL 8 or 5.7, on Laravel Forge, for example, use the command sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf. The options file /etc/mysql/conf.d/mysql.cnf is not the .cnf file we are using in this particular instance. Then add the sql_mode options you need and wrap them in quotes under the [mysqld] group. The sql_mode options needed […]

Laravel Servers SQL Web

Import and Export MySQL and PostgreSQL

There are many ways to export and import data from a database. You can use a Mac client like Sequal Pro for MySQL, for example. You can do the same for PostgreSQL, though I have not settled on a Mac client for PostgreSQL. Mac clients aside, you need can import and export your database SQL […]