Connect to MySQL database through the command line.

column] DATETIME);
Add column: alter table [table] add column [column] varchar (120); Add a column with unique auto increment ID: alter table [table] add column [column] int not null auto_increment primary key; Insert record: insert into [table] ([column], [column]) values (\
Select the record part: select [column], [other column] from [table]; Record calculation: select count ([column]) from [table]; Calculate and select grouping records: select *, (select count ([column]) from [table] as count from [table] group by [column]; Select a specific record: select * from [table] where [column] = [value]; (selectors: male,! =; merge multiple selectors into and, or)
Select records containing \
Update record: update [table] set [column] = \
Delete table: drop table; Delete database: drop database; Custom heat output name: select [column] as [custom column] from [table]; Export database dump (details are as follows): mysqldump-u [user name] – P [database] > db_backup. For SQL locked tables, use the – lock tables = false option (details are as follows). Get the database dump (details are as follows): mysql-u [username] – P-H localhost [database] < db_backup. sql
Cancellation: exit; You can view more commands in the source of the MySQL command installation table. Conclusion this post shares the method of connecting MySQL database from the command line and demonstrates it in stages. The content of this post must be mysql-u user name – P, which is used to connect to MySQL database from the command line. For this command to take effect, you must always remember the user name and password of the database. Finally, if you are in the localhost environment, don't forget that most of the user names are \

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *