Change column name and Make a unique column so we get nodupes

mysql> alter table [table name] change [old column name] [new column name] varchar (50); mysql> alter table [table name] add unique ([column name]); To change the column name and make it unique in MySQL, you can use the ALTER TABLE statement. Assuming you want to change the column name from old_column to new_column and make … Read more

How to Delete a column and Add a new column to database

mysql> alter table [table name] drop column [column name]; mysql> alter table [table name] add column [new column name] varchar (20); To delete a column in MySQL, you would use the ALTER TABLE statement followed by the DROP COLUMN keyword. Here’s the syntax: sql ALTER TABLE table_name DROP COLUMN column_name; Replace table_name with the name … Read more

How to Update database permissions/privilages

mysql> flush privileges; To update database permissions or privileges in MySQL, you typically use the GRANT and REVOKE statements. Here’s how you can do it: Granting Permissions: To grant permissions to a user, you can use the GRANT statement followed by the specific privileges and the database or tables the user should have access to. … Read more

How to update info already in a table and Delete a row(s) from a table

mysql> UPDATE [table name] SET Select_priv = ‘Y’,Insert_priv = ‘Y’,Update_priv = ‘Y’ where [field name] = ‘user’; mysql> DELETE from [table name] where [field name] = ‘whatever’; To update information already in a MySQL table, you can use the UPDATE statement. Here’s the syntax: sql UPDATE table_name SET column1 = value1, column2 = value2, … … Read more

How to give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs

# mysql -u root -p # mysql -u root -p mysql> use mysql; mysql> INSERT INTO user (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,’databasename’,’username’,’Y’,’Y’,’Y’,’Y’,’Y’,’N’); mysql> flush privileges; or mysql> grant all privileges on databasename.* to username@localhost; mysql> flush privileges To give user privileges for a specific database in MySQL, you would typically follow these steps: Login as root: Use … Read more