mysql授权
mysql> grant all privileges on *.* to 'root'@localhost identified by '123456';
Query OK, 0 rows affected (0.01 sec)
mysql> update mysql.user set password=password('123456') where user='root';
Query OK, 3 rows affected (0.01 sec)
Rows matched: 4 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@ip ops_user]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@ip-10-17-0-18 ops_user]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
#####
远程连接mysql
/usr/local/mysql/bin/mysql -h【IP】 -uroot -p123456
mysql备份单独一张表
mysqldump -uroot -p123456 --default-character-set=utf8 --comments=FALSE --tables --no-create-info=FALSE --add-drop-table=TRUE --no-data=FALSE test | sed 's/AUTO_INCREMENT=[0-9]*\s//g' >test_20180626.sql
备份导入MySQL
mysql> use test;
mysql> source /home/test/0101_0630_up_subjects.sql
网友评论