1.启动命令:
启动
/usr/local/mysql/bin/mysqld safe --defaults-file=/home/mysql/etc/my.cnf &
关闭
/usr/local/mysql/bin/mysqladmin -uroot -h127.1 -p shutdown
2.登录
mysql -u root -p
mysql -u [用户名] -p [密码]
创建用户
create user mysqlname@‘%’ identified by ‘mysqlpass’;
创建数据库
create database mydatabase defafult charset utf8_general_ci;
权限分配
应用权限
grant select,update,insert,delete,execute on mydatabase.* to mysqlname@‘%’;
管理权限
grant all privileges on mydatabase.* to mysqlname@‘%’ identified by ‘mysqlname’
grant super on . to mysqlname@‘%’ identified by ‘mysqlname’
函数权限
创建权限
grant create routine on mydatabase.* to mysqlname@‘%’;
修改权限
grant alter routine on mydatabase.* to mysqlname@‘%’;
执行权限
grant execute on mydatabase.* to mysqlname@‘%’;
权限刷新
flush privilege
导库脚本
导出整个数据库
mysqldump -uroot mydatabase>all_20190611_01.sql
导出单个数据库表结构和数据
mysqldimp -uroot -p mydatabase my_table>my_table_20190611_01.sql
导出整个数据库结构(不含数据)
mysqldump -uroot -p -d mydatabase>struct_sql_0521.sql
mysqldump -uroot -p -d mydatabase table>struct_sqk_0521.sql
删除脚本
drop database database