LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 09-15-2015, 04:06 AM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
phpmyadmin - how to truncate database


hi all,

just a query, when my database gets too big in size, how do i shrink/truncate it, not delete it as the database is live and people use it as its my openfire IM database

is trunacting the right thing to do if your database gets too big in size?

many thanks

rob
 
Old 09-15-2015, 10:38 PM   #2
robertdaleweir
Member
 
Registered: Jul 2006
Location: Canada
Distribution: Fedora
Posts: 93

Rep: Reputation: 11
Quote:
Originally Posted by robertkwild View Post
hi all,

just a query, when my database gets too big in size, how do i shrink/truncate it, not delete it as the database is live and people use it as its my openfire IM database

is trunacting the right thing to do if your database gets too big in size?

many thanks

rob
Hi robertkwild
I am using Apache Web server and MySql database on my web site. In MySql Truncate means "empty" the table and is not recommended for your needs. I would suggest that you write a PHP code (with SQL calls to remove what records you want to discard). Have it search your Database Table for some criterion, such as inactive users, and remove the "records" under program control. I have more than one Table in my Database and as such I might have to write some SQL code to remove records from both my Tables.
I always Export (in SQL code) each of my Database Tables to files so that I could if necessary re import, if I screw up. Because your Database is live, I assume you would create a small table or whatever and test on that. Hope this helps in some way...
Robert
 
Old 09-16-2015, 04:11 AM   #3
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
the thing is im not good at writing mysql scripts, can you help?
 
Old 09-16-2015, 05:51 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. start by getting regular backups going https://dev.mysql.com/doc/ and look up the mysqldump cmd

2. once you've got that sorted, then you can look into trimming the DB if it needs it.
You start by looking at the tables and understanding the relationships between them; you can't just delete random rows.
I'd start by asking at openfire's home https://www.igniterealtime.org/projects/openfire/ - I'm sure they know how to do that.
 
Old 09-21-2015, 08:32 AM   #5
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
thanks mate
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set password for single database of phpmyadmin fortran Linux - Server 2 03-19-2012 05:18 AM
phpmyadmin shows blank page; no "phpmyadmin" database in mysql qajaq Linux - Software 2 12-20-2009 12:23 PM
Copy MySQL database with PHPMyAdmin....how?!?!? vous Linux - Software 1 09-08-2009 11:18 AM
Neither Drupal nor phpMyAdmin can connect to database jnojr Linux - Software 3 07-10-2009 02:37 PM
mysql phpMyAdmin - attach files to database superevilspacemonkey Linux - Software 1 04-24-2009 02:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration