Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Repair Mysql Tables


is there some code to repair all the tables in my database in one go? instead of typing in "Repair Table <TableName>;" many times.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Cannot Repair Tables
I lost my developers and an office i do hardware support for is down. I can do the basics, BUT checking and repairing the tables dont seem to work. I need some better direction. Here is a link to a text file that shows ALL of the errors. Can someone please reply with answers or even a direction to go. The is NO backup of the database and the data is vital.

http://members.planetwebdev.com/web/admin/mysql/report.txt

if "holy $#%@%#$" is the only answer you have. Please spare me your comments.

Optimize Or Repair Db Tables
I bought a dating script online and been running it for 1 year, has about 1500 profiles, but the site is too slow now. Not about the host because I have godaddy host.
When I ask the script owner, they told me that I need to optimize the db to make tables indexed.
I already tried to go to phpmyadmin, click on all tables, then, select OPTIMIZE table from drop-down list,.... but it does not help. The site is still running too slow to load. I am using high speed intenet.

Repair Corrupt Tables
I have a couple of tables in a database the give me the following error when I try to open them:
thanks!
'can't open file: 'clinch_a.ibd (errno:1)'
What can I do to fix this problem.

Auto Repair Tables
This is my first post on this board.
Well.. now to my question.
I´m running MySQL 4.1.11 on a linux-mandriva server.
Some days, there are a few tables in on of my databases that gets "corrupted" for some strange reason.
And this always happends, when i´m NOT around to repair the tables.
So.. i was wondering if there is some kind of php-script or program, that could repair the tables automaticly

Mysql Crash/repair
I've got a couple of directory sites that looks like somehow something's been deleted or crashed (the directory isn't showing any listings).

I had a look in the mysql directory, and all I see are a bunch of .frm files. I don't see any MYI or MYD files.

Is there any way to recover or repair? I'm assuming I need those files, and that the lack of them is what's causing my problems. We've done a couple of things lately that may have caused the problem like a server move and a hard reset.

Server To Repair Mysql DB
I've got a corrupt 8GB mysql table and am obliged to use
myisamchk -r -o -f --safe-recover

But this is taking immensely long time, and is going slower and slower
The time it would take to repair 2.7 million rows would be far too much than I can make my client wait.is there somewhere a service where I could sync a copy of the db files under /var/lib/mysql/, repair it on their powerful server, and bring it back home?

MYSQL Database Alteration, Repair And Restore Takes Huge Time
I am trying to run alteration queries on one of my mysql tables which has more then 22,00,0000 lakh records. Its been 23 hours and the process is still running (I have to close all the sites running on server due to same).

My server specifications:
Red Hat 9.0
Pentium 4 3.0 GHz
2 GB Ram, Burst RAM 5 GB
Running webserver, mail server as well.

Is there a way I can view the minute process details, as what table record is being updated ?

How To Repair A Db ?
when I execute from command line (linux centos server)

# mysqlcheck -o chatspa_main

chatspa_main.BAmigMSG
error : Can't find file: 'BAmigMSG.MYI' (errno: 2)
chatspa_main.BuscaAmigos
error : Can't find file: 'BuscaAmigos.MYI' (errno: 2)
chatspa_main.CLKEXclkcontrol OK
chatspa_main.CLKEXmain OK
chatspa_main.CLKEXstats OK
chatspa_main.CTICelebPhotos
error : Can't find file: 'CTICelebPhotos.MYI' (errno: 2)
chatspa_main.CTICelebrities
error : Can't find file: 'CTICelebrities.MYI' (errno: 2)
chatspa_main.ChatSpain_Users OK
chatspa_main.MCmain
error : Can't find file: 'MCmain.MYI' (errno: 2)
chatspa_main.MCvotecontrol
error : Can't find file: 'MCvotecontrol.MYI' (errno: 2)
chatspa_main.phpCardData
error : Can't find file: 'phpCardData.MYI' (errno: 2)
chatspa_main.phpCardUsers
error : Can't find file: 'phpCardUsers.MYI' (errno: 2)
chatspa_main.phpCatData
error : Can't find file: 'phpCatData.MYI' (errno: 2)

How to fix/remove these "Can't find file" errors please ?

Repair Table
Is there a way to issue a "REPAIR TABLE table_name" command to all
tables at once? Something like "REPAIR TABLE *"

Repair By Sorting
I have an application which uses MySQL to manipulate large amounts of data for short periods of time. The data set contains 13 columns each of which is indexed and typically about 30 Million rows.

I create a new table, load the data in to the table using load local infile from a CSV and then add indexes to each of the columns; the columns are a combination of integer, date and text. The text columns have a simple index and a full text index.

I need to be able to sort on each column (in a grid - I use DevExpress) and search on the textual fields.

I appreciate that getting the data into MySQL and creating the indexes is never going to be quick but I need to optimise this process as much as possible. Typically a data set would be loaded and viewed for a few hours and then a new dataset loaded and the process repeated.

When the index process is underway I get the above state displayed by show processlist and wondered if this is a problem. The whole load/index process takes about an hour and I would like to improve on this if I can.

I am also looking for suggestions as to how I may be able to best optimise this.

I use a dedicated server and the MyISAM engine.

Repair Message
Running MySQL 4.0. I had an error in my database that wouldn't let me run selects (it said error 127 from table handler). I ran repair on the table and it fixed it dropping one row. I was just wondering what the meaning of the repair message is so that I can try to avoid the error in the future.

Found link that points at 11548 (outside data file) at 10152.

REPAIR TABLE
Can REPAIR TABLE be used for rebuilding indexes on an InnoDB table? The only documentation I have seen is for MyIsam. There are 30 million records which has taken me 9 days to populate. I've made a backup but want to make sure this will work before I try it.

Keycache Repair
I ran the following querry on a large database:
ALTER TABLE vbpost ADD FULLTEXT INDEX (title,pagetext).
The querry is taking a very long time to execute (the database is also very large). I logged in with another shell and ran showprocess. It showed the querry in state keycache repair.
Do I need to do anything at this point? Is there a way to tell if the querry is still running?


REPAIR Repeatedly
I'm running MySQL 4.018 on Fedora. I've got a few tables with more than 1M records, and if a larger number of deletes is thrown at them or a MYSQLDUMP is attempted, I get a "got error 127 ...". I've run "REPAIR", MYSQLCHECK and every other repair possibility I could find. The tables are supposedly ok after the repair operation, and can be queried normally. As soon as I try to run a MYSQLDUMP or a large number of deletes, I get the corrupted tables again.?

Can't Repair A Table
It seems I have a corrupt table and have tried the REPAIR TABLE command but during the operation I get this return.
mysql> REPAIR TABLE users;
+-----------+--------+----------+-------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+-----------+--------+----------+-------------------------------------------+
| sdc.users | repair | error | Can't open file: 'users.MYD'. (errno: -1) |
+-----------+--------+----------+-------------------------------------------+
1 row in set (0.00 sec)

Repair Corrupt Table
I am using xoops (a CMS) and MySQL on a website with not so much traffic. I am using "phpMyAdmin - 2.8.0.3-Debian-1" with "MySQL - 5.0.21-Debian_3-log" on a Debian unstable.
Three tables have gotten corrupt recently and won't let themselves be repaired. When I use repair it says status OK, but if I try to delete a record or if I analyze the table again, it says that the table was reported as crashed and that it needed a repair. The only useful message I get, if I analyze the table is about wrong key at page 111616.

ANALYZE, OPTIMIZE, CHECK, REPAIR
when to use the ANALYZE, OPTIMIZE, CHECK, REPAIR commands. From what I can tell, ANALYZE and OPTIMIZE are for making the table optimal to increase performance. CHECK and REPAIR are used to find & fix corruptions. ANAYLZE takes a lot less time to run than CHECK.

The questions I have are:

1. What is the general rule of thumb on regular (daily) maintenance of a MySQL DB?

2. Will ANALYZE report table corruptions? If so, I don't even need to call CHECK, I can directly go
do REPAIR?

3. If the anwer to #2 is no, meaning I have to run CHECK TABLE, should I separate the optimization exercises from the find-corruption-and-repair routines?

Indexing Table Forces Repair By Sorting
I have a problem whereby i am loading a large table into MySQL - approx 3 million rows

I then create indexes on most of the columns including normal and full text indexes on certain columns that I need to sort and search.

The indexing operation takes an age (about 7-8 mins) on each column, whether it is a normal or fulltext index. Example:

mysql> show full processlist;
| Id | User | Host | db | Command | Time | State | Info
|
| 1196 | root | PAULS:2078 | registries | Query | 457 | Repair by sorting | CREATE INDEX VALNAMEidx ON FULLTAB_113 (VALNAME
(64)) |
5 rows in set (0.01 sec)

I have tried SET MYISAM_SORT_BUFFER_SIZE=1024000000 - this has no affect

I have also tried creating the indexes when I create the table but I get the same thing.

The tables are populated by load data local infile and no additional rows are added once populated I am running MySQL 5.0.11 on a dual core pentium 2.4Ghz with 2GB RAM Any ideas how I can speed this up?

Mysqlcheck: Table Is Marked As Crashed And Last Repair Failed
I'm using the command "mysqlcheck --all-databases --auto-repair --silent"
and I see these warnings and errors (listed below) on a daily occurrence.
What could cause these indexes to be out of order? Another thing I don't
understand is why an increase in the number rows constitutes a warning?

Hoping to here from MySQL users who have came across this. I'm using the
MyISAM storage engine and MySQL 4.1.11 on Red Hat Enterprise Linux.

Check Table And Repair Versus Optimize Table
I am confused about the difference between running a CHECK table and REPAIR(if necessary) versus running an OPTIMIZE table. It's not very clear in the documentation, but seems that OPTIMIZE table does a check and repair in addition to the other functions performed by optimize.

I have inherited some legacy code that does a check and repair and optionally follows it with an optimize. That seems redundant to me and I would like to streamline the code to make it an "either-or" selection.

Maximum Allowed Tables/db, Fields/tables, Records/table
1)tables that can be created in a MySql database.
2)fields that can be created in a MySql table.
3)records allowed in a MySql table and in a MySql database.
4) allowed joins in a MySql table/database.

Cannot Alias Locked Tables / Join To Unlocked Tables ?
If you manually issue a table lock then query that table, aliasing the table generates an error. If you try to join the table to another table that is not locked, you will receive an error. What is the reason for this?

Multiple Smaller Tables V.s. Fewer Bigger Tables
What is the best way to store data in a database? Multiple smaller tables (which means many Inner/Left Joins when fetching the information) or fewer bigger tables (which means few or no Inner/Left Joins when fetching information).

How Does MySQL Many Tables?
I have 10 features which basically select rows from a database and display the results on screen. Each of the 10 features have their own table which stores the info.

table_latest_members
table_birthday_members
table_something_members
table_featured_members

Each table is identical to the other and will only store about 60 records each. So each query is exactly the same, only that the table name is different.

SELECT user_id FROM table_latest_members LIMIT 30;

Would it be logical to combine all 10 tables into one large table and add an additional column (TINYINT type) with an INDEX to filter would what type (latest, birthday, something) will be selected?

MySQL Tables
i am starting to use MySQL with PHP and i wanna know how the MySQL works on the sever's side. Can i put my MySQL tables anywhere on the server or i have to put it on some special folder?

Tables And MySQL
I have a web application that runs a query in a mysql database and then displays the results in a HTML Table.  I use borders in the table cells but some of the results generate null returns and the border is not displayed around the table cell.  If I fill the null fields with a character (.) it displays fine.  Is there any way I can make it think that it is not null even thought nothing is displayed in the cell?

MySQL Help Tables
On http://dev.mysql.com/doc/ there's a section headed MySQL Help Tables. I've downloaded them and done what it says to do, but I'm none the wiser. How does one use these tables for Help? Is the database information_schema the one that contains them? (I don't know if it was there before.)

STOP PRESS: Ignore the above. I've just realised that the Tables are probably something to do with the HELP command, of which I wasn't aware until just now. Is that what they're for?

MySQL Tables
My client wants GROUPS for his members, what I am thinking is creating a table for each group - since each group has a leader ID number and member list.

Would this be a good way to do it?.

MySQL Tables
I'm new to MySQL and had a question about "linking" tables
Basically I want two tables that automatically update each other when changed. When something is added in table a I want it to be added in table b, and vice versa. Or when something is changed or deleted in table a I want it to apply to table b aswell, and vice versa again.
Is this possible? maybe through the actual tables or a script of some sort. I'm using phpMyAdmin if it helps.

MySQL Tables
I'm trying to "lock" mysql tables - to prevent rows being updated/deleted - I still want to be able to insert new rows (legal reasons ).
I have toyed with the idea of changing the user permissions - can I simply change it so that no-one can perform an update on that table, even root? But I feel there must be a simpler way that I and my many web searches am missing.

MySQL Tables
have a table where misc data are stored. Right now this table has
about 30 columns, but for sure it will be more in the near future. So I
wonder how the big number (50-100) of table's columns affect for MySQL
DB performance. Maybe it's better to create more tables rather than more
table's columns ?

Set Up Mysql Tables
I am trying to get my head around this problem.What it is, is I am wanting to have a login section.I know how to do the php but when it comes to the mysql im trying to understand the process.
Do you set up a blank database then when people sign up their details automatically go to the database?

Joining 3 Tables! Mysql Help...
Here is my current setup:

featuredvideos: videoid
videos: videoid, userid, videotitle, videodescription
members: userid, username, email

So I have a page where I want to list all the featured videos, and I want to grab all the video details as well as details about the user. So I need to somehow join all 3 of these tables.

Currently I joined 2 tables:

PHP

$sql = "SELECT * FROM featuredvideos JOIN videos ON featuredvideos.videoid=videos.videoid";

but I also need information about the user, how would I go about doing this? Also, would it be advantageous to also store the userid in the featuredvideos table as well?



Mysql Or PostgreSQL? Big Tables
I have to do an aplicattion with on big table (million of rows).
I want know what of both (Mysql or PostgreSQL) manages more efficiently big tables.

Mysql Can't Create Tables
I am trying to create tables in Mysql version 3.23.58
this is what I typed in the terminal:

mysql> create table MyVChanels(
-> Alerts varchar(50),
-> TypeID int not null primary key,
->
-> index(TypeID),
->
-> )type=innodb;
ERROR 1064: You have an error in your SQL syntax near ')type=innodb' at line 3

No matter what kind tables i am creating I get the same error with or
without primary key. To make it simple i even tried to create a table with one field but no help the same error pops up.
However, created tables in Window XP Mysql and works perfectly.

So I guess if there is some kind of configuration that I need to do?

Organizing Mysql Tables
I currently code for an affiliate network. We run a bunch of campaigns that only allow traffic from specific countries. Right now, we have not built in any country limitations to the campaigns, but I'm trying to work on adding the functionality. However, I'm having a bit of trouble figuring out how to add a list of allowable countries to each campaign. Ultimately, I want my script to grab the IP of the web surfer, check the country of origin, and check to see if the country is allowable by the campaign. Also, I would like it if I could simply select a country, and list all campaigns that allow traffic from X country.

So for a campaign (a row in the campaigns table), is it wise at all to just have a column called countries, and have each country (2-letter abbreviations eg. UK) listed in that field separated by commas, as in:

countries
----------
US,UK,CA,DE

Somehow I don't believe that is an efficient approach to the problem. The only other way I can think of is to have a table for each country, and list the campaignID in each table. So if campaign #50 allows US, UK, CA, and DE traffic, it will have 50 as an entry under each of the tables: US, UK, CA, DE. However, this seems to be an even more inefficient approach, especially since there are hundreds of countries, which would require hundreds of tables.

Temporary Tables In MySQL (using Php)
I have the following problem:

I have a switch with case 0, 1 and default.

in case 0 I create a temporary table where I insert data then. When I get to the case 1 in my switch, I want to make a select(*) on this data in the tmp table, afterwards I delete all data in the table and insert the select from before... But when I do this I get always the tmp table does not exists. But when I do a select on it it works..

Any knowledge about, why it doesn't work?

To descibe the thing a little better: ....

Linked Tables In MySQL
I have a web application (ColdFusion) that uses an MSAccess database as it's datasource. I would like to migrate to MySQL since the site is growing.

However, I am unsure about how to use MySQL in the following context.

In the Access db we use liked tables so that the database is actually in 3 parts (ie 3 separate access databases) with the DSN pointing to the main database which links to the other 2.

We do this because the content of the 2 linked dbs varies daily and we need to be able to upload/download content without disturbing the main db.

MySQL Tables Performance
I have a table where misc data are stored. Right now this table has
about 30 columns, but for sure it will be more in the near future. So I
wonder how the big number (50-100) of table's columns affect for MySQL
DB performance. Maybe it's better to create more tables rather than more
table's columns ??

MySQL Indexes Or Tables In RAM?
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?

No Relationship Between Tables In MySQL
I'm using phpMyAdmin and MySQL 4.1 and since I'm new to MySQL I'm creating a test database using SQL statements from the "MySQL Tutorial" book by Welling and Thomson. I typed out the SQL statement into the SQL view as follows... Code:

MYSQL / PHP Delete From Two Tables
I need a query that will delete one vehicle(v_id) AND all service(s_id) records associated with the vehicle.  The problem is that my existing query only works when there is one or more than one service record associated with the vehicle deleted...it will not work if there is one vehicle and no service records.  

Here is my query:

DELETE vehicles, service FROM vehicles, service WHERE vehicles.v_id = ".$delete_vehicle." AND service.v_id = ".$delete_vehicle."

I am using PHP if that helps out with the solution.

I have two tables - the relationship is one vehicle(v_id) to none, one, or more than one service record(s_id):

service
------------
[s_id](index)
v_id
s_type
s_date
-----------
and
vehicles
------------
[v_id](index)
v_make
v_model

Staging Tables In Mysql ?
from moving data from oracle to mysql
i was thinking of incorporating the data transformation process
on the oracle side but i was told that instead i can just transfer
the data to mysql staging tables and have mysql do the transformations

can someone provide more info on this?

MySQL And LOCK TABLES
I have a website which uses PHP and MySQL. However Im not sure when I explicitly needs to control concurrenct access to the database using LOCK TABLES. For example, there is an auction section on the site where users bid on an item, and here I do. But do I really need to do this everywhere? Say for example, just inserting to or updating a contactDetails table?

Exporting Mysql Tables
I have a database with one main table and many sub tables. The main table holds titles of books and IDs of corresponding tables (ie. author, publisher, etc...). Basically the table is in the "normal form".

My problem is this. I want to be able to export the information in the databse to a tab delimited file.

Basiclally, what I would liek to happen is to export into a file like the whole database was on one table, where it would list each title and everything that corresponded to that title from the other tables.

Child Tables MySQL 4.1
Is there a way to look for all the child tables of a table in MySQL
4.1?

I know for the latest version of MySQL you can use
information_schema.table_constraints to look the same. Is there
something similar there for MySQL 4.1?

Right now, I'm running SHOW CREATE TABLE `$table` for all tables, and
then seeing if they have the table I'm looking for any foreign key
relationship. This dosnt seem to be the most effective way of doing it.

Mysql Select From Two Tables
I have two tables tb_customer and tb_posts.

I want to select all records from tb_customer, but I also want to have as a column the total number of records from tb_posts with the same ID, the problem is that some of the records in tb_customer, don't have any records in tb_posts with that id.

I got this query, which does almost what I need, except it does not return the results which will have a "post_count" of 0

SELECT c . id , count(p . id )AS post_count FROM tb_customers AS c , tb_posts As p WHERE c . lastdate >0 AND p . customerid =c . id group by c . id ORDER BY `post_count` DESC

MySQL Joining Tables
I have 2 tables, one that has

$query="CREATE TABLE products (id int(6) NOT NULL auto_increment,fname varchar(15) NOT NULL,lname varchar(15) NOT NULL,stage2 varchar(20) NOT NULL,itemnumber varchar(20) NOT NULL,quanity varchar(20) NOT NULL,email varchar(30) NOT NULL,location varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";

In the 2nd table I want to have 3 items, itemnumber, quanity, and descrition.
I want itemnumber from the 1st table to refer to the 2nd table and update the quanity. For example, If I order 3 of item #12345 then i want it to update the #12345 to 3.

And then say in a week someone else orders 4 of #12345 then i want it to change to 7. How would I go about linking these tables together,

View MYSQL TABLES VIA FTP
I have been asked to play around with the current website and make some changes etc, before i launch into it i want to get a good idea of how it is structured etc. It's written in PHP with a MYSQL backend.

I have setup a test environment on my local machine and copied the files from the existing site by grabbing them via FTP ... now everything runs via localhost except i cannot connect to mysql via phpmyadmin i played around with the settings in the config.inc.php file and it allowed me into phpmyadmin but there was no database??

How do i see the actual mysql tables or at least get a .sql file dump so i can recreate an identical test db ??


Copyright © 2005-08 www.BigResource.com, All rights reserved