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




Replication Database On Slave Is Not Updated


We are using mysql v4.0.24 on Linux machines.

I'm trying to set up replication with a master and only one slave
database.

The syncronization seems to work well, the relay file on slave is wrote
correctly (Read_Master_Log_Pos and Relay_Log_Pos are updated) but the
information on slave database is not updated.

Master and slave are sincronyzed as shown below but for some reason I
don't understand. I have to say thay sometimes the replication worked but sometimes
setting up a new slave or changing a slave to master it does not. Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
NOW() At Replication Slave
We have 3 MySQL servers in replication, 1 master and 2 slaves. One slave server is 300 seconds behind the master due to heavy SELECT statements.

If I run INSERT query (containing NOW()) on master at 10:00 AM, what time will be saved in the slave server which is 300 seconds behind? The query is

MySQL Code:

INSERT INTO users (username, password, signup_date_time) VALUES ('user1', 'pass1', NOW())

Can't Set-up Slave In Replication
I'm trying to set-up replication following a book and on-line guide. This
is over SSH with a tunnel (not sure if the tunnel's required).

The master appears to be set-up OK (easy enough).
The slave however isn't behaving.

I've got a my.cnf with the following:

[mysqld]
master-host=127.0.0.1
master-port=APORT
master-user=AUSER
master-password=APASSWORD
server-id=2

When I start the slave up and do show slave status - I get 0's and
blank entries back.

I've tried setting it up using:

CHANGE MASTER TO
MASTER_HOST='localhost',
MASTER_USER='AUSER',
MASTER_PORT=APORT,
MASTER_PASSWORD='APASSWORD',
MASTER_LOG_FILE='AFILE-bin.001',
MASTER_CONNECT_RETRY=10;

This sets up the slave bits and show slave status looks much better,
however,

SLAVE START;

returns...

The server is not configured as slave, fix in config file or with CHANGE
MASTER TO

I can only seem to find this message in pages that have a list of all Mysql
errors.

Replication - START SLAVE
When I try to start the slave for replication

I get a sytax error:

START SLAVE;

not much should be able to go wrong when you're typing in two words.

Replication: 2 Masters And 1 Slave
I need to replicate 2 databases (each one resides in a different
server) to a single slave server. Reading the documentation I have
running the master/slave replication, but i need to replicate the
other database too, the problem is: I need replicate the other
database and that database exists in the other server, so how I
configure the other master server/datatabase in the slave?

Master/slave Setup To Do Replication
using mysql 4.1.7, have a master/slave setup to do replication.

Is there anyway to prevent the slavedb from accepting inserts other than the replication inserts?

If rows do get inserted directly into the slave, there is an error because the two databases no longer match. Is there anyway to recover from this?

MySQL Replication (Multiple Master & 1 Slave)
Is it possible to replicate 2 or more master server & 1 slave server?

I have tried 1 master & multiple slave running but I want to try 4 master server & 1 slave server. Is this possible?

Replication, Slave Thread: Error Connecting To Master: Access Denied For User:
I have MySQL 3.23.41 on a RH-7.2 Linux used as local server. I'm trying to replicate the databases from server (192.168.0.1) to another linux PC (192.168.0.3).

Following the manual, i grant to the master a user with file privileges, and
edit both my.cnf files. The master starts fine but the slave mysql.log shows up an error:

Slave thread: error connecting to master: Access denied for user:
replica@localhost' (Using password: YES) (0), retry in 60 sec

Last Time A Mysql Database Updated
Here is my problem, my company has been storing fedex data in a access '97 database (the data is imported into this access database via a program called DirectLink), and because we are mainly a php house and we use mySQL, we need to take that information from the access database and mirror it in the mySQL database. To top things off I have to use ASP to write this code to do this.

Now for the Access database I can use a FSO to find out the last time the database was updated. I've had no problem with that. And I've had no problem mirroring the information across to the mySQL database. My problem is, is there a way using the FSO to find out the last time the mySQL database was update. Since mySQL creates several different files for the different databases it holds - is there a specific file I need to look for or is there a query I can run that will tell me?

Mysql Master/Slave Read Write To Database Question
If I setup my database as master/slave and user enters data into the html form. This data is written to the master database. After html form submission user is directed to view.html to view the submitted data. The view.html page does the read from the slave. Would it be safe to assume that the data that user submitted would be written to master and immediately displayed in the view.html by reading slave data base?

Replication And Mysqdump Issue With Database Name
I have a database called abc-100 which seems to cause problems with
replication and importing sql files created with mysqldump.

First, if on the master we create a temporary table (because we don't
have subselects yet) it causes the slave to die with the following.

Relay log says:

DROP /*!40005 TEMPORARY */ TABLE abc-100.temp_summary

And the error log says:

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 '-100.temp_summary

Second, on doing a mysql < dump.sql for a database restore, I have to
manually edit the dump file first and use `` around the abc-100.

So, apparently the - or the -100 is an invalid database name? If so,
why would mysql allow me to create it in the first place? Is there
any way to make this work without changing the database name?

Changing the name is not a trivial matter because I am dealing with
many databases with the same issue, 100, 101, 102 etc. I am more
concerned with replication than the dump.sql as I can always edit the
database names to be contained in ``.

Replication And Mysqdump Issue With Database Name
I have a database called abc-100 which seems to cause problems with
replication and importing sql files created with mysqldump.

First, if on the master we create a temporary table (because we don't
have subselects yet) it causes the slave to die with the following.

Relay log says:

DROP /*!40005 TEMPORARY */ TABLE abc-100.temp_summary

And the error log says:

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 '-100.temp_summary

Second, on doing a mysql < dump.sql for a database restore, I have to
manually edit the dump file first and use `` around the abc-100.

So, apparently the - or the -100 is an invalid database name? If so,
why would mysql allow me to create it in the first place? Is there
any way to make this work without changing the database name?
Changing the name is not a trivial matter because I am dealing with
many databases with the same issue, 100, 101, 102 etc. I am more
concerned with replication than the dump.sql as I can always edit the
database names to be contained in ``.

Database Replication Binlog Issue
my client does not do a "USE dbname" and will not binlog a query like

"update in dbname.foobar set foo = 1".

I know this can be changed to work, but is there any way around this? I have the given example used in many many places.

2 Databases Updated
i have a software running over a mysql db. i want to, for example at midnight myself manually ask it to sinchronize with another db in another host, without the necesity of running the whole mysql again from zero.

Updated Column?
is there a way to obtain only the affected columns after an update query? After an update query, that involves 10 columns, I know that only 2 columns are really updated (because the values of the other cols don't change). I need to know the names of that changed cols, for logging purpose.

Fields Updated
Is there a way to extract what fields were actually updated in an update query?

For example, let's say I have a table with a firstname, a lastname, and a company field, with values of "John," "Smith," and "IBM," respectively. I run this query:

 Update table 
set firstname = "John", 
lastname = "Smith", 
company = "Open Source Development"
where ID = 1 

Is there a mySQL function/query that will tell me that the only field actually updated in this query was the "Company" field, and the other two remained unchanged?

Field Does Not Get Updated
I have an educational course. Every time the student finishes a lesson, I update a field to keep track of where the student has to go when he logs-in next time. Sometimes this works well lesson after lesson. Other times the field simply stops updating even though the student may have gone through many more lessons. It is also unpredictable when the field stops updating.

Checking For Updated Rows??
Is there a query where i can select rows from various tables ordered by when they were last updated/created (whatever comes first) without having a timestamp field in the tables saying when it was created/updated?

Is It Not Possible To Delete The Same Row Which Is Updated Using Trigger?
I am trying to check quantity = 0, if it is equal to zero, I want to delete that row. So basically, on updation of a row, I check for quantity is zero and try to issue delete statement on successful condition. But mysql says, 'Can't update table 'listing' in stored function/trigger because it is already used by statement which invoked this stored function/trigger'

delimiter //
drop trigger catalogue.on_listing_item_zero//

create

trigger catalogue.on_listing_item_zero
after update on catalogue.listing
for each row
begin

if ( NEW.quantity = 0 ) then

delete from
catalogue.listing
where
`sku` = NEW.sku ;

end if;

end;
//

Locking A Record From Being Updated?
I am building a system where more than one person has access to a table, and everyone has the ability to update a record.

How do I prevent a second person being able to update that record if someone else has that record open for editing already?

Determine If SQL Update Really Updated ASP
Ive done alot with record sets but we are rewriting some code to make it more efficient and we are replacing our old code with single SQL Update statments.

In this following example how would I determine if a record was updated or not. Using ASP

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DSN=SOMEDSN"
oConn.CursorLocation = 3
strSQL = "UPDATE testtable SET TESTVAR = 'testentry' where PKID = 12"
oConn.Execute strSQL

I have tried using a variable called sqlselected, setting it to 0 before the execute, then using

oConn.Execute strSQL, sqlselected

then the sqlselected variable i thought would give me the number of rows updated, however its still returning 0 even though it is updating the record in the database.

Timestamp - To Update When The Row Is Updated.
i would like to have a table with ( among other things ) a time stamp column that holds the time that the row was created.

this seemed easy enough by just executing
ALTER TABLE mytable ADD stampcolumn timestamp;

but the problem with this is that the time stamp updates for a given row any time that row is updated.

I would like to have a timestamp that just stays at its inital value of the row insertion time. is this possible? how?

Importing Updated Data
I've set up a MySQL database and everything is working fine however I've received some updated data (CSV) and need to import it into my database.

The problem is I've added extra fields into the table and whenever I update the data, it goes through ok, but deletes the data from existing that aren't included in the new updated CSV file i'm importing.

Check If A Table Has Been Updated
I'd like to find a way to check if any modifications has been made to a table. I'm using mysql 4.1. I'm trying to find the least resource intensive method of doing this.

Struggling With 'updated'-NOW() Field
I try to learn SQL by figuring out things.
I want to make a listing of all records that were changed in the
last... 1, 6, 12 hours/days.
I have a field called 'updated' managed like: UPDATE tablename SET
updated = NOW(), .... WHERE....
I created a query like this: "SELECT * FROM tablename WHERE 'updated'

Timestamp Not Being Updated - Is My UPDATE Command Right?
PHP

mysql_query("UPDATE prv_msg SET date_read=now() AND confirm=&#391;' WHERE id='$userid'")or die (mysql_error());

I'm not getting an error message, but a time stamp is not being inserted into the date_read column

Copying Tables Every Time They're Updated
I'm got two tables which need to kept upto date with each other. Is there a command i can cron to copy all the updated entries?

Decimal Value Gone AWOL In ASP When MySQL Updated!
My ASP driven site has always used MySQL as the DB backbone, mainly as the
hosting costs of MySQL are far cheaper than SQL Server at the mo, and it has
worked fine until my ISP thought that they were doing everybody a favour by
upgrading to v5 from v4.

What happens now is that any ASP query that I do that involves any of my
MySQL Decimal data type fields goes belly up. It will not work.

Looks to be an issue with ASP, MyODBC and MySQL, but I just wanted to check
if there was a better/more reliable data type than Decimal (which obviously
performs the same numerical functions) and if there was a quick way to
convert all of my Decimal fields to this new type.

Sending An Email When A Table Is Updated
I have to create an online bookmakers for a project for college and i want to be able to sent an email confirmation to the winners.I have a bets table containing the fields.

bet , user no. , win

if the win field is true i want the an email to confirm they won.
taking the email address from the users table. which has the fields.

user no. , email address.

Auto Increment Fields Get Updated
I need to use an auto increment field, but I dont know how they get updated in a query.

If I had say:

INSERT INTO `table` VALUES ( '1','2','3' )

and the 3 row was auto increment, would i put a number, or just put nothing.

MySQL Slave
We are having problems where at least once a day our MySQL slave server gets about 1700 seconds behind the master.Any ideas what is causing this? I looked in .err logs and it says nothing.A simple stop/start brings it back to to 0.

Slave Servers
i have do replication with 1 master server to 3 slave servers.
And i want to grant the 3 slave servers only select option for all user;

Reconnect Slave
Is it possible to re-connect the slave db to a master after it has been out of sync for 2 days?I can't seem to figure it out and it is a pain to have to redump all the data and re-import all the data as I have over 20 different databases.

Row Cannot Be Located For Updating. Some Values Might Have Changed Since It Was Last Updated
I've recently migrated from access to mysql with vb6). Unfortunately, i get the following error whenever the .update is executed on the recordset.

"Row Cannot be located for updating. Some values might have changed since it was last updated"

The select statement is:
Select * from tablename, connection,3,3 (have also modified the 3,3, to be adOpenDynamic, adLockOptimistic)

I have tried checking the flag To Return Matching Rows, I've added the option = 2 in the connection string, i have a primary key field in the table, and I've also tried re-assigning it to itself.

Searching Table Which Is Being Constantly Updated Locks Up.
I'm logging mail to a database, and using php to make queries. The mail is
coming in constantly, so the table is being added to, in batches of up to 30
mails. I have around 600k records.

The queries are properly indexed, i think; i have index on date and domain,
the fields I query on.
Mostly the queries run quite fast, but sometimes the queries take up to two
minutes.

The query is a union of two queries into two different tables.

mysqladmin -proc says the query is in state "sending data" for the whole
time.

Should it be a problem querying on a live table this size?
Any parameters I can tweak and/or monitor?

What if I seperated the data in two tables, one for today being updated
constantly, and the other for the historical data, and todays data being
moved to historical at midnight. Then queries to the historical data can be
stored in the query cache.

Master/Slave Restoration.
I have 2 servers (A and B) setup as Master and Slave respectively.
Upon A's failure, all client's request will be directed to B.

How can I set A to become master again after its been restored from
its failure? In chapter 4.10 of mysql docs, it mentioned (vaguely)
that A will become B's slave to sync all operations that had happened
after the failure. Finally, upon full sync switch A to become Master
again and B to slave.

How can I setup A to be a slave of B? The problem I faced is that I
can't find out what the bin log and position is from B since "show
master status" is always empty. I guess B still thinks its a slave.

Flushing Writes On Slave Db
i need to make a slave database "READ" only.ie, it must not not respond to data manipulation commands. i want only "select * from table_name" command to work on the tables in the replicated db on the slave. How must i go about it?

MySQL Master/Slave
In the case of 2 3.23.X series mysql databases in a master/slave
replication setup (myiasm tables), if a FLUSH TABLES WITH READ LOCK is
put on the slave, does the master effectively lock too because it is
waiting for the binlog update(s) to be confirmed from the slave, or
does the master merrily carry on not caring in the least that the
slave tables are locked?

Master/Slave Restoration.
I have 2 servers (A and B) setup as Master and Slave respectively.
Upon A's failure, all client's request will be directed to B.

How can I set A to become master again after its been restored from
its failure? In chapter 4.10 of mysql docs, it mentioned (vaguely)
that A will become B's slave to sync all operations that had happened
after the failure. Finally, upon full sync switch A to become Master
again and B to slave.

How can I setup A to be a slave of B? The problem I faced is that I
can't find out what the bin log and position is from B since "show
master status" is always empty. I guess B still thinks its a slave.

Updated Table Fields Rolling Back After Update
I'm having to correct some scripts written by a collegue who is presently not around. I had to update 2 fields with over 13000 rows. The update do work well but the problem is that somehow, the initial values in the fields do roll back in again - kind of auto updating to the former values itself. Any ideas what could be wrong? Any way round it?

Masters Replicating To A Single Slave
I have two big databases in two different servers, each database
it's different too and I need to replicate each one to a single
mysql slave server.

I need this:

MasterA ---> SlaveC <-- MasterB

So, I need dbA and dbB replicated on the slave server C.

Slave-load-tmpdir Option
I have just installed mysql server 5.0. However, when I was trying to start the server by invoking mysqld, it complained that a directory/file is not found.

I then viewed the variable names and found that the slave-load-tmpdir variable was pointing to a non-existing path. I have tried

mysqld --slave-load-tmpdir=<my new path> --standalone

but whenever I restart the mysqld, the variable is still defaulted to that old path....what should I do to change the default setting for this variable?

MyISAM On Master And InnoDB On Slave Server
Is this possible to have a MyISAM table on master server and change its storage engine (to InnoDB) on slave server in a replication environment?

If this is possible, what should I consider before changing MyISAM to InnoDB on slave server?

Here is the table structure:

Forwarding Insert/Updates From Slave To Master
Is there a way within MySQL to forward all Inserts/Update requests from the
Slave to the Master, or much I rearchitect my application to carry two
connection; one connection to the Master for updates and the other
connection to the slave for Selects?

Procedures To Promote Slave To Master Server
What is the proper procedure for promoting a Slave into a Master
replication server?

We want to do some fail-over testing. When we tried this in the past, the
former master would not replicate. We got an error: "master and slave
have equal MySQL server ids".

The fail-over procedure includes renaming the slave and exchanging IP
addresses with the master server. We did not change the server-ids.

I haven't found any information on promoting slaves to master servers.

Drive Failed Now Mounted As Slave How To Recover Db's??
I had a server lose a drive. This customer didnt back his database. I
mounted old failing drive as a slave and can see .frm .MYI & .MYD But if I
copy them to /var/lib/mysql/db_name it says .frm doesnt exist ???? How do I
fix this????

Drive Failed Now Mounted As Slave How To Recover Db's??
I had a server lose a drive. This customer didnt back his database. I
mounted old failing drive as a slave and can see .frm .MYI & .MYD But if I
copy them to /var/lib/mysql/db_name it says .frm doesnt exist ???? How do I
fix this????

Command SHOW SLAVE STATUS G, Shows That SLAVE_IO_RUNNING
I am trying to set up a master/slave replication.. I followed the instructions in the mysql manual.. I am using mysql 4.0.12 installed in windows xp... I have found out that the replication is not working ...

when i make the command SHOW SLAVE STATUS G, it shows that SLAVE_IO_RUNNING : No.
How can I make this run? What could have I done wrong?

Restart Slave After Master Has Died In Replicated Environment
Our master database ran out of connections and we had to restart the
server (couldn't SSH into the box). Rebooting the server worked and
of our clients resumed activity.

The problem is that the slave didn't start automatically so I tried to
do a START SLAVE; on it.

This is the latest shown in the error log on the slave.


040110 20:06:13 Error reading packet from server: binlog truncated in
the middle of event (server_errno=1236)
040110 20:06:13 Got fatal error 1236: 'binlog truncated in the middle
of event' from master when reading data from binary log
040110 20:06:13 Slave I/O thread exiting, read up to log
'user1_master.002', position 802078191

(THIS IS AFTER I DID A SLAVE_START TODAY 1/20)

040120 8:56:39 Slave I/O thread: connected to master
'slave@db1.ezboard.com:5000', replication started in log
'db1_master.002' at position 802078191
040120 8:56:39 Slave: there is an unfinished transaction in the
relay log (could find neither COMMIT nor ROLLBACK in the relay log);
it could be that the master died while writing the transaction to its
binary log. Now the slave is rolling back the transaction. Error_code:
0
040120 8:56:39 Error running query, slave SQL thread aborted. Fix
the problem, and restart the slave SQL thread with "SLAVE START". We
stopped at log 'db1_master.002' position 802078147.

What Privileges Need A User To Run &quot;SHOW SLAVE STATUS&quot; ?
i use mysql 4.1.22
i need to create an user who must have rights to run only "SHOW SLAVE STATUS" query.
from online documentation i wasn't able to find what privilege i must grant to this user to be able to do only this query.


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