【DB】MySQL操作命令
1. 创建MySQL数据库
# mysql -uroot -p MariaDB [(none)]> show databases; MariaDB [(none)]> create database opstest DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; MariaDB [(none)]> grant all privileges on opstest.* to user@'%' identified by 'password'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit
2. 设置MySQL用户密码
# mysql_secure_installation # mysqladmin -u root -password <new pass>
3. MySQL数据库导出和导入
# mysqldump -uroot -p <db name> > backup.sql # mysql -uroot -p <db name> < backup.sql
浙公网安备 33010602011771号