Forum Replies Created

Viewing 1 replies (of 1 total)
  • I don’t know that my problem was exactly the same as everyone else is having, but yesterday I was having some trouble after migrating a database. We have several servers where we develop and test our WordPress work, and often the simplest way to move all the data over is by copying the database and files, and adjusting the site URL for the new server. Often though, that leaves the old URL sprinkled throughout the database, like on the post GUIDs and in some of the other fields here and there, like post content when it used an absolute link.

    The way I was fixing that yesterday was by doing a search and replace of the old URL with the new one in a mysqldump of the database, then loading the modified dump. The problem I found was that some of the data in the database is JSON encoded, where it stores a string by giving the type (‘s’) the length (i.e. 35) and then the content of the string (i.e. “https://localhost/myblogurl”). But when I replaced the old URL with the new URL, it changed the length of the string, and originally I hadn’t been changing the length number.

    When I had invalid JSON in my database, it gave me exactly the results everyone is describing: “error establishing a database connection” even though the credentials are correct, the admin saying the tables might need to be repaired, and the repair and optimize process saying everything is fine, but the problem still occurring. I found that when I fixed the string lengths then everything got happy again.

Viewing 1 replies (of 1 total)