473,698 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Altering table structure in live database?

Jim
Hi,

I want to add a field to a table in a database that is live and being
accessed from the web. I'm using phpMyAdmin and when I try to add the field
I get error #1142 (ER_TABLEACCESS _DENIED_ERROR) "ALTER command denied to
user 'xxx' for table 'yyy'"

I'm a newbie to MySQL but I guess that's a reasonable error as there are
probably open connections. If that is the reason, is there a way I can force
all connections to close and not reopen while I make the alteration to the
table structure? It won't matter in this case that users will experience
access problems while this is taking place (all access is read-only too.)

If possible I want to do this without stopping the MySQL server - it is a
shared resource AFAIK and the host is in the US (I'm in the UK) so easiest
to coordinate if I can do it all from here if possible.

Many thanks.

--
Jim
Nov 23 '05 #1
1 4081
>I want to add a field to a table in a database that is live and being
accessed from the web. I'm using phpMyAdmin and when I try to add the field
I get error #1142 (ER_TABLEACCESS _DENIED_ERROR) "ALTER command denied to
user 'xxx' for table 'yyy'"
You have insufficient privileges to do what you want to do. You
need, among other things, Alter privilege on that table.
There's one or more privileges you don't have.

Read up on the GRANT command, do SHOW GRANTS FOR me@my.host (I
believe phpMyAdmin has a nice way of showing your privileges),
and talk to your database administrator about getting additional
privileges needed.
I'm a newbie to MySQL but I guess that's a reasonable error as there are
probably open connections.
Open connections don't matter. ALTER TABLE will wait if someone
is modifying the table. You can do a time-consuming ALTER TABLE
(ALTER TABLE usually copies the table, and if it has 10 million
rows this can take a while) and MySQL will even let queries read
the old table while you're building the new ones. Writes will
wait for the new table.

Assuming that the new table and the old table are both acceptable
to applications (e.g. you don't delete a column needed for a query,
or you don't add a column in the middle and mess up the ordering
of columns for "select * from ...", and you don't lengthen a field
beyond the buffer the application is using for it), and the
applications don't have tight time constraints, doing an ALTER TABLE
on the fly with read and write operations going on is safe. But
something may wait for a while, either the ALTER TABLE or some of
the other queries or both.
If that is the reason, is there a way I can force
all connections to close and not reopen while I make the alteration to the
table structure?
It's not necessary.

You can stop other connections from making changes to any
tables (this requires RELOAD privilege) with:
FLUSH TABLES WITH READ LOCK;
and undo it with:
UNLOCK TABLES;

(this is often used while you are making a backup).
However, this is overkill for altering one table.
It won't matter in this case that users will experience
access problems while this is taking place (all access is read-only too.)
If all access is read-only, chances are there won't be any access
problems.
If possible I want to do this without stopping the MySQL server - it is a
shared resource AFAIK and the host is in the US (I'm in the UK) so easiest
to coordinate if I can do it all from here if possible.


Gordon L. Burditt
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1911
by: Dariusz | last post by:
I have written a database that counts the number of times a file has been accessed, so I can then later display the results on what is "hot" and what is not. At the moment all it does is count the total hits, it does not log per-month the results, which is what I'd like to try. So suppose I have a database that on initial creation (in month May) looks like: ID URL Accessed 1 whatever1 1
0
1570
by: Dave Serrano | last post by:
I have a question about altering tables and growth of the database and transaction log. I have a database which is approximately 35GB. I had to make a change to a column in the largest table (approximately 7 million rows). I changed this column from varchar(30) to varchar(40). This column is not in any indexes or involved with any triggers. My database grew from 35GB to 56GB and my transaction log grew from 9GB to 25GB. Now all the...
3
3284
by: Dan Williams | last post by:
I'm trying to do a simple alteration to the table design of one of our SQL 2k tables, simply changing an identity row so that its not 'not for replication', and its taking absolutely ages to do so, and stops the sql server from working. Whilst it's attempting the update, no one can access the database, the sqlservr.exe memory usage shoots up and enterprise manager reports a not responding status. Eventually after about 10 minutes, it...
36
4646
by: toedipper | last post by:
Hello, I am designing a table of vehicle types, nothing special, just a list of unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor etc etc For the table design I am proposing a single column table with a field name called vehicle_type and this will contain the vehicle type. Sot it will be
3
387
by: Douglas Buchanan | last post by:
Newbie to donnet This is an example of a structure given in vs.net help ============================ Private Structure Employee Public GivenName As String ' This employee's given name. Public FamilyName As String ' This employee's family name. Public Extension As Long ' This employee's telephone extension. Private Salary As Decimal ' This employee's annual salary.
5
1890
by: brett valjalo | last post by:
Hey Gang! SORRY ABOUT THE LENGTH! Nice to see some of the same faces around this place from way back when ... Whatta buncha CDMA addicts some o' y'all are ;) Don't get me wrong, I understand, believe me! Took me a lot of therapy, various 12-step programmes, interventions by loved ones, etc, but I finally managed to excavate, er, extricate myself from the
9
8387
by: JimmyKoolPantz | last post by:
IDE: Visual Studio 2005 Language: VB.NET Fox Pro Driver Version: 9.0.0.3504 Problem: I currently have a problem altering a DBF file. I do not get any syntax errors when running the program. However, after I alter the table and open microsoft excel to look at any changes; I get the following error: "This file is not in a recognizable format" If I do open the file in excel it looks like its not formatted.
10
2194
by: Omar | last post by:
I'm looking for a programming language or module that sorta looks and feels like MS Excel (I love and think in tables), yet has the power and open-endedness of python or javascript. I'm still pretty new to python. any ideas? i've been having some fun with VBA in excel, but I want something I can save as en exe and call my own creation, y'know?
1
5156
by: zufie | last post by:
Hi, I want to specifying a foreign key by altering a table. First, I create an ORDERS table without specifying a foreign key. Here is my code: CREATE TABLE ORDERS (Order_ID integer, Order_Date date, Customer_SID integer,
0
8610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.