Mobile app version of vmapp.org
Login or Join
Dunderdale272

: Manually insert text into existing MediaWiki table row? I'm trying to update a page for a MediaWiki database running MW version 1.26.4. The MediaWiki is currenty suffering unexplained Internal

@Dunderdale272

Posted in: #Database #Mediawiki #Mysql

I'm trying to update a page for a MediaWiki database running MW version 1.26.4. The MediaWiki is currenty suffering unexplained Internal Server Errors, so I am trying to perform an end-around by updating the database directly.

I logged into the database with the proper credentials. I dumped the table of interest and I see the row I want to update:

MariaDB [my_wiki]> select * from wikicryptopp_page;
+---------+----------------+---------------------------------------------------------------------------+-------------------+------------------+-------------+--------------------+----------------+-------------+----------+--------------------+--------------------+-----------+
| page_id | page_namespace | page_title | page_restrictions | page_is_redirect | page_is_new | page_random | page_touched | page_latest | page_len | page_content_model | page_links_updated | page_lang |
+---------+----------------+---------------------------------------------------------------------------+-------------------+------------------+-------------+--------------------+----------------+-------------+----------+--------------------+--------------------+-----------+
| 1 | 0 | Main_Page | | 0 | 0 | 0.161024148737 | 20161011215919 | 13853 | 3571 | wikitext | 20161011215919 | NULL |
...
| 3720 | 0 | GNUmakefile | | 0 | 0 | 0.792691625226 | 20161030095525 | 13941 | 36528 | wikitext | 20161030095525 | NULL |
...


I know exactly where the insertion should occur, and I have the text I want to insert. The Page Title is GNUmakefile, and the Page ID is 3720.

The text is large at 36+ KB, and its sitting on the filesystem in a text file. How do I manually insert the text into existing table row?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Dunderdale272

1 Comments

Sorted by latest first Latest Oldest Best

 

@Radia820

As you see MediaWiki does not store the page content within table page, only the details of the page exist within that table. You need to locate the table 'text' and find the relevant row, thn use INSERT INTO.

There is a much simpler way if your not too SQL Saavy do the following:


Backup the entire database using:


SSH Command: mysqldump -u [username] -p [database name] > [database name].sql

Download the SQL backup to your local computer
Open the local SQL in notepad or another editor if its too large
Find the 'TEXT' row and replace with your desired content
Upload the edited SQL to your server
Create a new database:


MySQL Shell: CREATE DATABASE newdatabase;

Upload the new SQL to the new database:


SSH Command: mysql -u [username] -p newdatabase < [database name].sql

Edit the LocalSettings.php with details of the new database
Test
I purposely had you create another database making the old database as a backup. You can purge the old database once you are satisfied that everything is updated and working.


If you want to edit the SQL directly then you can find more information on Stack Overflow.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme