Read-only TIMESTAMP Field
I need a table with TIMESTAMP field which must be always set to a CREATE server time (so the == CURRENT_TIMESTAMP).
How do I make it read only? I.e. make user unable to override the default value (CURRENT_TIMESTAMP) on CREATE and UPDATE. Is it the Q of user permissions? If yes, how to set 'em correctly to allow create/update but allow only to read timestamp?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Read Size Of Field
Given a table like this, where X can be any size: table { name int(X) } Is it possible to get the value of X?
Write Once Read Many Field
I am designing a database and one of the requirements my client has is that once data is entered into certain fields it cannot, under any circumstances, be changed. Is it possible to create a write once read many (WORM) field in MySQL directly?
First Field Isn't Read Using SELECT
I am trying to gather information from a dbase, displaying it as I go. The script works fine except the first field that matches the criteria isn't read or displayed. For example: On this page I check to see if a session variable 'tripNumb' is set. If it isn't, it goes to the dbase and gets the last trip number and adds one to it. The problem is that if there is only one field in the dbase it doesn't read it. Code:
Timestamp From Any Field
Is it possible to get a timestamp from a table that doesn't have any timestamp field? In other words, I've got a table with three columns, none of which are a date, or timestamp type column. Only varchars (that don't contain any time/date type data). Is there a SQL statement that will return the time each record or row was entered into the table?
Can I Do An UPDATE On A Timestamp Field
I am creating a time management system whereby the administrator can go in and UPDATE an existing Timestamp field with a new time. I have the administrator input the date and time in a textbox. Any clue how he can update the field with this new data??? The table TimeTable has columns like TimeStamp, DateStamp and UserID besides Autonum. I think it should be something like... UPDATE TimeTable set TimeStamp=06/29/2005 12:45:56 PM where UserID=10 and DateStamp=06/29/2005 This however errors on me--any clues?
TIMESTAMP As Primary Key Field?
If I need a primary key (PK) that can contain the numbers as large as an INT, I would normally use an INT. But the problem with INT is that, if the keys are all used up (exhausted), I need to start thinking of ways to reuse “skipped” or “deleted” primary keys. In other words, I need to fill up the “gaps” so as not to waste them. Another problem is that, if the PKs are all used up, I need to have another timestamp field in the same table to tell me which very old record I can delete to make space for the new record that I want to insert. (Assuming that we can delete very old records. Eg a web email account where, say, an account which stayed dormant for 5 years.) Since INT has these problems, and since both INT and TIMESTAMP datatypes have a size of 4 bytes, I was thinking, why not just use TIMESTAMP for my PK field instead. Besides TIMESTAMP is just an integer internally in MySQL, representing the number of seconds since epoch (1970-1-1 00:00:00). It would be as index-able as an INT? Searching through it will be just as efficient? Using it as foreign keys in multiple tables would give no problem? Is using TIMESTAMP as a PK field OK ?
TIMESTAMP Field Automatically Set
I want to add a timestamp field to my table so that it is set automatically when a new record is added. I don't want it updated. I tried to follow the manual instructions but I can't get it to work. 1) I added a field called "EntryTime" to my existing table. Its the only timestamp type field. 2) I tested an insert with a NULL set for the column. This didn't work. 3) I added CURRENT_TIMESTAMP as the default value to the field. I tested the insert, and this didn't work. I even tried renaming the field to TIMESTAMP and didn't work as well. Whats the skinny to get this to work?
Update A Table In A Timestamp Field
I would like to update "field A" in a table in which "field B" is a timestamp. I would like to update all fields whose date is less than a given date. This is the command I was using to no avail: UPDATE my_table SET Field_A=50, WHERE filed_B <= '2005-05-12 15:08:44'; MySQL is returning the following error: #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE filed_B <= '2005-05-12 15:08:44'' at line 3 My Host is using MySQL 4.0.25. Can anyone point me in the right direction? What am I doing wrong?
Getting Year, Month, Day From A Timestamp Field.
I'm currently programming my own blog, however I've come into a minor problem with the way I want to display my archived posts. I want to display a list by year (2006, 2005, etc.) then a list of months for the specified year (nov, dec, etc.). I've searched the documentation and have been unable to find a sql command that retrieves parts of a timestamp. ie; timestamps are in YYYYMMDDHHMMSS format. I'm looking to extract the year, or month from that. ie; SELECT YEAR(timestamp) AS y FROM blog_posts GROUP BY y ORDER BY y DESC. or replace YEAR() with MONTH(). You get the idea. I did find a YEAR() command in the documention but it doesn't look to be what I'm looking for, since I was unable to find it's system commands MONTH() and DAY().
Timestamp Field Not Updating When Record Modified
I have a couple different tables ... all of which I am trying to use a timestamp field to track when records were changed.The problem is that when the records are updated the timestamps are all showing up as all zeros. The timestamps are all set to "not null" and i have tried multiple defaults (CURRENT_TIMESTAMP, now(), time(), etc) with no success. This is happening on 4 different tables in 2 different databases (all on the same server tho).
Timestamp And Current_date/timestamp
Im stuck with a sql query. Basically I have a db that stored a timestamp off everyone who has a successful login. I want to be able to count all the people who have logged into today? How do I do that? I thought the following would work but it didn't: SELECT count(date) FROM nn_users_logs WHERE date = CURREN_TIMESTAMP
Read-only Tables
Is there a way to mark a table as read-only (after inserting some initial data, of course)? I'd like to do it for optimization reasons - hoping that mysql could take advantage of the knowledge it's read-only, for caching, etc.
Read From MySQL
I installed appache server and php and work great.. But i cant read data from my sql . I use this code to connect to connect to mySQL server:localHost username:root password: **** // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'password'); if (!$dbcnx) { die( '<p>Unable to connect to the ' . 'database server at this time.</p>' ); } ... ...... Should i create another account in mySQL? .or the php can not communicate with mySQL ?''
How Do I Read The Log-bin File?
Does anyone know how to read the binary log from a client workstation? The log is named hostname-bin.001 and when I open the file it is unreadable (obviously because it is in binary).So making a shortcut to that file will not do the trick. How can I open the file via a mysql command prompt on a client PC?
How To Lock A Max ID From Being Read
Basically what I want to do is read the maximum id_B from some table with id_A = 5 and insert a new row with a new id_B. While I do this I don't want anyone else to be able to insert a new row with id_A = 5. If I do this: SET AUTOCOMMIT=0; SELECT MAX(id_B) FROM table WHERE id_A = '5' LOCK IN SHARE MODE; // do php code here to increment MAX(id_B) by 1 and save it to $new_id_B INSERT INTO table (id_A, id_B) VALUES ('5', '$new_id_B') COMMIT; Would this prevent other users from inserting a new record with id_A = 5, while I'm adding a new record with id_A = 5.
Read Default Value
I have table with simple data. all of fields have default value how to read this default value, using php
How To Read Log Files
I running on Win2K3 and need to know the basics of mySql system health logs (their location, their expected contents and format) and any other logs that might help track down problems when mySql crashes. I've seen that it will log EventViewer events and that within the C:Program FilesMySQLMySQL Server 5.0data directory there are some logs. I've been able to read the .err log since it's text but the other logs are binary. Do I have to use a cmdline app within the mySql distriubtion to read the binary files? Or, is this a well documented format and there are several 3rd party utilities out there that will parse/display these logs. In general, where does mySql maintain its log files, does it generate separate log files per database and what are some common applications that I need to get familiar with to view the contents of these files?
Table Is Read Only
I've upgraded a server from RHEL4 to RHEL5, and in the process gone from 4.1 to 5.0. I copied over all of the database files, adjusted permissions, and ran mysql_upgrade. It's a very simple application that needs no security, so it's running without passwords. The application works fine reading, but will not write to the table: [root@chekov etc]# ip_age_off_autoblock iptables: Bad rule (does a matching rule exist in that chain?) iptables: Bad rule (does a matching rule exist in that chain?) DBD::mysql::st execute failed: Table 'addresses' is read only at /usr/local/scri pts/ip_age_off_autoblock line 47. Unable to execute at /usr/local/scripts/ip_age_off_autoblock line 47. I've tried granting privleges to anonymous users: mysql> grant select,insert,update,delete,create,drop,references,index,alter on *.* to ''; to no avail. Absolutely nothing shows up in the log file.
Read Out An AUTO_INCREMENT-ed Value
The first column of my table is AUTO_INCREMENT. I fill my table with 5 records with a blanco value in their first field. The first column of my table will then hold the values 1,2,3,4,5 (top>down). Then I erase those 5. Then I add a new record with a blanco first value. It will get number 6. My problem in this scenario: I want to read out this number 6 before I will insert that record. Is that possible?
How To Read Phpbb
php file is loaded as codes on windows, but when u upload it on web u get the codes showed as image and stuff, so my question is, when using local host (windows xp) what prog or how i can see the php files not as codes/source when opening but as image or table or whatever.
Table Is Read Only
i transfer my mysql database in windows into linux by copy and paste it.when i want to update table record,it promt an error msg: Error Code : 1036 Table 'ardi02' is read only (2 ms taken).
Read Only Tables
I log on as a user who has select, insert, update, delete privilegies but when i'm trying to for example insert row in my table myadmin reports me that the table is read only. where can I as a root change this and what are the options?
Read The .err File
Working on installation in Mac OSX 10.4. Need to read the .err file, but don't know how to find it. If you can help, please show the path from from the 'top' i.e. /usr/local/mysql/ and the rest of the path.
Table Is Read Only
I backed up my tables, formated my computer, and reinstalled. Then I reinstalled mysql and capied the files back in. Now every time I try to do any table operations. I get "Table is read only". So I tired palying with the file permissions.. They are rw for user and group.. and they are all owned by mysql and the mysql group.
MySqlDataReader.Read()
Then you ask the Mysql .Net Connector Reader to Read forward is it moving a server side cursor forward? Or is it just moving forward in a cache of the query result that is already on the client? I assume(hope) it is the latter but just asking.
Can't Read Dir Of './mysql/'
I am currently using MySQL under Mandrake Linux 10.1 and have an error (see the title). I have an error message when I want to see All the databases into my Server. I am using PHPMyAdmin.
Read In A .sql File
I have a large SQL file that contains a bunch of create table statements.How do I get mysql to read in this file and process the sql. =20.I am not thinking load data infile because it isn't text
Not Allowing To Read Files
I have program with data accessed by MySQL. In my assume, I copy program and its data files to my friends, and they run program with pleased faces. And now, the first friend wants to delete all program related data files and copy program related data files from second friend(or he can also get any program formatted data files) and save them into data folder. My problem: the first friend can run program with only my data files; he can get any data files from anywhere and save them into data folder, but program won't be allowed to read these data. Does everyone have some good ideads?
MySql Write Vs Read
Essentially I am faced with a design choice; have an oft run (modifiable) query run every time any user wants to run it, comparing criteria againt each and every user in the table and delviering list OR saving that list (user/user/) so the next time all that needs to be queried is the existence of a record in the table. The basic tradeoff; version 1 there are many simultaneous queries of the user db on complex search criteria; version 2 there are fewer but their are as many far more simple queries to a much larger table, not to mention many writes to same to keep the table current. I know this is pretty vague, but I was wondering if in general there is an area that mysql excels in vis a vis complex query smaller tables simple query larger tables. Question 2 is there anyway to guestiate the search/write times of a user log in to both query and update? #Records, fields, etc? I'd like to keep log in to < 10 seconds max.
Creating Read Only User
When looking over the instructions for phpMyAdmin they want a read-only user. What GRANT permissions do I need to assign so a user has just read-only rights?
Can SQL Read From A File Or List
I'd like to do a select statement that would substitute variables from a file containing a list of strings, or a list of strings right on the command line. Here's my pseudo code: SELECT {some value from my list, table or whatever} FROM {some list of tables in a file or other table etc}..
Read Ibdata1 Or Ib_logfile1
Is there a way to read the ibdata1 or ib_logfile1 files? I'm looking for some information. It doesn't have to be complete but wanted to take a look. It's all binary right now and wondered how to convert to .txt or something that i can read.
Read Primary Key While Entering A New Row
I have a website with a form on it.Upon pressing submit, the information gets entered into the database on a new row.Each row is numbered with auto_increment (it's the Primary key).The auto_incremented field is called the ID. When the user submits his information, I would like an automatic email to get sent to his email with his unique ID number and a recap of this information.How can I do this? Basically it seems to me that all I need to know is the command to be able to read information off of the row that you're currently putting information on.The only way I can think of to do this is to have the form input all the information, then close that connection and start a new one in which it searches for the row that contains all that information and that way I can get it to read the ID then.Is there a shorter way?
Table Is Read Only Error
We recently started using MySql as the db behind some java and cold fusion applications. A couple times we've gotten an error that says the table is read only. Stopping services and closing all open sessions does not correct the problem. We use Mysql Control Center as our GUI, and the repair functions there also give us the same error. The only thing that seems to work is rebooting the server. Anyone run across this before?
How To Read A File Into Mysql
i have created a output file from oracle which contains insert statements like insert into tms.tms_rem_exclusion_list values (3337) insert into tms.tms_rem_exclusion_list values (4175) insert into tms.tms_rem_exclusion_list values (4227) iam new to mysql and someone told me that if i create such a file i can import this data into the mysql table at the mysql prompt like mysql> tms_rem_exclusion_list < test.sql; (name of the above file) but iam getting this: ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp onds to your MySQL server version for the right syntax to use near 'tms_rem_excl usion_list < test.sql' at line 1 first of all i am not sure where to keep the test.sql file ie in which directory so i kept it under the scripts folder.
Creating A Queue Read-out.
I am trying to create *what should be* a simple result of where a person is in line, but I am having a lot of trouble. I have spent hours searching, and for one thing I don't even know what to search for. So here's what I am trying to do... Let's say I have rows 1-10 in a database and rows 2,5,6,9, & 10 are all marked with '0' and the others with '1'. If my $ID is '6', then my code would print out < 3 of 5 >. Here is the code that I do have... $num_in_line = (I don't know what query to put here.) $of_total = mysql_result(mysql_query("SELECT COUNT(ID) FROM all_programs WHERE list = '0'"),0); echo $num_in_line.' of '.$of_total;
Read Back Up File
I got this error. shell> mysql -e "source /var/lib/mysql/test.sql" backuptest ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'backuptest'
READ A TEXT FILENAME
Since a text file can be loaded in the MySQL, I feel that there is a way MySQL will be able to read a text file name. Any idea how to do that? And after reading the text file name, how do i insert it in the column.
Read Text From A File
I have a text file which contains the following data 1&david&0248814&software engg&1973 2&thomas&8475623&commerse&1965 I have created a table <info> with the attributes nr name reg_nr sub born_yr I need to somehow read the data from the file n insert them into the table attributes... does anyone over here know how could this be done ? to insert the data to the table could be done with insert into <table> values <value> but the problem is how can i read it from the file...leaving the '&' sign ?
Read From Merge Results
is there a way in MySQL to read in the records of a table and to package duplicates into one value : |id |type |subType | Category | | 00000000001 |Accommodation | Guest House | 3Star | | 00000000002 |Accommodation | Bed and Breakfast| approved| can it be outputted like this: Accommodation -> Guest House -> 3Star -> Bed and Breakfast-> Approved I am still trying to merge the output from this query into a triple combo.
Editing Read Only Tables
ive got a database in phpmyadmin..i need to change a value in a coumn in a table..but when i do so, the following error message would show up: Quote: MySQL said: Documentation #1036 - Table 'table' is read only how can i deal with it
How Can I Set The Login To Read 2 Different Database Tables?
I need to enable my login function to read data from 2 different tables in my database, the discussion forum table and the customer table. Right now, visitors can only login as customers because the login function is setup to read from the customer table, and not both of the tables. I had a few website developers do the site for me, so I have tried to learn some javascript tutorials; I have learned the basics, but I cannot seem to figure out how to do this. I think it has to do with an "or" function or "if, then" statement. How can I set it up so that the username and password can be read from either of the tables? The current setup is listed below:
How To Dump The Database And Read It Back In?
Our database just slowed down radically. Certain queries drive CPU utilization through the roof. This happened once before, and the technican simply dumped the data to disk and then played it back in. This seemed to correct database corruption. After than, the database went back to normal performance. Does anyone know how to do this?
How To Read Composite Values In Tables
i have three table codes -------------it conatins post codes of different regisons day-------------------------it contains the day on which delivery can be made e,g post code 44444 will be served on mon , tue or day 1 day 2 time--------------------it contains the time on which delivery will be made on certain days e,g on monday time is 2-5 , 6-9 , 11-12 and so on now i want to display all data in the form of report but i don't know how to do it
|