mysql改mariadb_MySQL/MariaDBSQL修改表字段类型、备份数据库操作实例

1、修改表字段类型alter table nodes modify column info varchar(200)

示例操作入下:MariaDB [dbmanager]> alter table nodes modify column info varchar(200);

Query OK, 0 rows affected (0.02 sec)

Records: 0  Duplicates: 0  Warnings: 0

MariaDB [dbmanager]> desc nodes;

+-----------+--------------+------+-----+---------------------+-------------------------------+

| Field     | Type         | Null | Key | Default             | Extra                         |

+-----------+--------------+------+-----+---------------------+-------------------------------+

| id        | varchar(36)  | NO   | PRI | NULL                |                               |

| nodename  | varchar(20)  | YES  |     | NULL                |                               |

| ip        | varchar(20)  | YES  |     | NULL                |                               |

| username  | varchar(20)  | YES  |     | NULL                |                               |

| password  | varchar(20)  | YES  |     | NULL                |                               |

| os        | varchar(20)  | YES  |     | NULL                |                               |

| pubkey    | varchar(400) | YES  |     | NULL                |                               |

| role      | varchar(100) | YES  |     | NULL                |                               |                              |

| sn        | int(10)      | YES  |     | NULL                |                               |

| info      | varchar(200) | YES  |     | NULL                |                               |

| status    | int(10)      | YES  |     | NULL                |                               |                           |

+-----------+--------------+------+-----+---------------------+-------------------------------+

14 rows in set (0.01 sec)

MariaDB [dbmanager]>

2、备份数据库mysqldump -h hostname -uroot -p dbname > /root/sql/bak.sql

示例操作

[root@hadron ~]# mysqldump -h master -uroot -p123456 dbmanager > /root/sql/bak.sql

[root@hadron ~]# ll sql|grep bak.sql

-rw-r--r-- 1 root root 25908 11月 28 09:34 bak.sql

[root@hadron ~]#

本文由职坐标整理并发布,了解更多内容,请关注职坐标MySQL数据库频道!

已标记关键词 清除标记
表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
©️2020 CSDN 皮肤主题: 1024 设计师:白松林 返回首页