nerdegutta.no
MySQL and things to remember
26.11.23
Miscellaneous
When working with mySQL there are certain things you'll need to remember, but that never sticks to your brain. Here's a list of mine:
Login
mysql -u root -p
Change privileges
This will give you remote access to the database.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'secret_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
Delete a table
DROP TABLE < tablename >
Restart mySQL
sudo /etc/init.d/mysql restart
Search and Replace
Some an example:
UPDATE < tablename > SET variable = REPLACE(variable, old_value, new_value);