cancel
Showing results for 
Search instead for 
Did you mean: 

How can I drop database column via ssh

How can I drop database column via ssh

I need to uninstall one of the modules.

I need to drop the column from the database

How can I run this command via ssh to remove it?

I tried on this way not working with me.

1- sudo mysql -u root -p

2- DELETE FROM setup_module WHERE module='_'

3 REPLIES 3

Re: How can I drop database column via ssh

@yousufkhan31c8 

Run the below commands:

1) mysql -h localhost -u root
2) use magento23
3) ALTER TABLE admin_user DROP COLUMN created;

Where,

localhost = host name
root = user
magento23 = database
admin_user = table name
created = column name which you want to delete

After second step, you can run your required query on the selected database.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: How can I drop database column via ssh

1- mysql -u root -p
2 - use database_name
3 - DELETE FROM `setup_module` WHERE `setup_module`.`module` = 'module_name';
If issue solved, Click Kudos & Accept as Solution.
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool

Re: How can I drop database column via ssh

Hello,

Run the following command to connect with the database

mysql -u USERNAME -h HOSTNAMEORIP DATABASENAME -p

Where USERNAME should be your DB Username (Like- root)

Where HOSTNAMEORIP should be your DB Hostname Or IP (Like- localhost)

Where DATABASENAME should be your DB DatabaseName

After filling the details when you click on enter button then you need to fill the Database Password, after filling the password and click on enter button then you will be successfully connected with your database.

To Delete the Column name from the database table
If you are using the MYSQL server then follow the below query to DROP the Column from Database

ALTER TABLE `table_name` DROP `column_name`;

If you are using the SQL server then follow the below query to DROP the column from the Database

ALTER TABLE `table_name` DROP COLUMN `column_name`;

Thanks.