Tag Archives: mysql

How to move a column in a table in mySQL

Execute the following query:
ALTER TABLE mytable MODIFY COLUMN columntobemoved INT AFTER columnbefore;

mytable = the table you are modifying
columntobemoved = the column that will move in the table
columnbefore = the column that will be before the column you move. I.e. if you have columns a, b, c and you want to put columntobemoved after b (so between b and c), you would use b as the columnbefore value

 

How do I use mySQL Workbench to backup a database?

  1. Open up mySQL Workbench
  2. Under "Server Administration", select an instance with the correct database privileges, otherwise create a New Server Instance with the correct privileges
    1. To create a new instance, click New Server Instance
    2. Select localhost if the mySQL service is installed on the local machine, otherwise select Remote Host
    3. Enter the username/password, click Next.
    4. Confirm your password and click OK
    5. Click Next on the Testing Database Connection step
    6. Click Next on the Set Windows configuration parameters for this machine step
    7. Click Next on the Testing Host Machine Settings step
    8. Click Continue if prompted for success on Reviewing your settings
    9. Type in a name to identify this instance... can be whatever; then click Finish
  3. Click on Data Export under DATA EXPORT / RESTORE
  4. Under the Object Select tab, select the backup method you would like to use "Export to Dump Project Folder" or "Export to Self-Contained File" and click the Start Export button.