mysql -uroot -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'Jzit123!';
配置一个支持远程登录的帐号,
1 2 3 4
mysql -u root -p use mysql; grant CREATE,SELECT,UPDATE,INSERT,DELETE,DROP,ALTER on *.* to 'jzit'@'%' identified by 'Jzit123!';//创建work帐号并授权,同时设置密码 flush privileges;//生效配置
之后便能在我们本地通过调用mysql指令远程登录服务器上的mysql server中
1
mysql -ujzit -P3306 -h39.106.56.35 –p //本机远程登录mysql指令
离线安装
1.解压及创建目录
1 2 3
[root@hadoop39 local]# tar xzvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz [root@hadoop39 local]# mv mysql-5.7.11-linux-glibc2.5-x86_64 mysql [root@hadoop39 local]# mkdir mysql/arch mysql/data mysql/tmp
一般不需要设置mysqladmin的密码,直接从root或者LDAP用户sudo切换 #[root@hadoop39 local]# passwd mysqladmin Changing password for user mysqladmin. New UNIX password: BAD PASSWORD: it is too simplistic/systematic Retype new UNIX password: passwd: all authentication tokens updated successfully.
if user mysqladmin is existing,please execute the following command of usermod. #[root@hadoop39 local]# usermod -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
hadoop39.root:mysqladmin:/usr/local/mysql/data:>mysql -uroot -pd1dFE(F214' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.11-log
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user root@localhost identified by 'Jzit123!'; Query OK, 0 rows affected (0.05 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Jzit123!' ; Query OK, 0 rows affected, 1 warning (0.02 sec)
hadoop39:mysqladmin:/usr/local/mysql:> service mysql restart
hadoop39:mysqladmin:/usr/local/mysql/data:>mysql -uroot -p 'Jzit123!' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.11-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.