Archive for the ‘MySQL’ Category

Import large database in remote server

This item was filled under [ MySQL, PHP ]

If you owned slow internet connection, it would be headache if you have large database to be imported in a remote server. Either you import the database through MySQL GUI or phpMyAdmin, the execution time is mostly will exceed the maximum execution time allowed, resulting in an script timeout problem. It would be same if [...]

Continue reading...

Tagged with: [ , , , ]

INSERT/UPDATE using existing table/row Value

This item was filled under [ MySQL ]

There is a table ‘user’ with score. Simple enough.

id
username
score

10
neobie
530000

INSERT STATEMENT
In my application I need to add another user with username ‘neobie_2′ and score of 1000 less than user ‘neobie’.
I would use
INSERT INTO user (username, score) VALUES (‘neobie_2′, (SELECT score-1000 FROM user WHERE username = ‘neobie’));
MySQL will return an error message “You can’t specify target table [...]

Continue reading...

Tagged with: [ , , , , ]

MySQL Default SQL-Mode

This item was filled under [ MySQL ]

If developers’ testing server platform configuration is different with the real server testing configuration, it could be troublesome for both developers and users, only to realize that the real system is buggy and certain process could not be completed. In worst case, undesired wrong data is inserted, resulting in unwanted aftermath.
Here we talk about MySQL [...]

Continue reading...