Linux上通过MySQL命令访问MySQL数据库时常见问题汇总
Linux上通过mysql命令访问MySQL数据库时常见问题汇总
1)创建登录账号
#创建用户并授权
#允许本地访问
create user 'test'@'localhost' identified by '123456';
#允许外网访问
create user 'test'@'%' identified by '123456';
#grant 权限 on 数据库.* to '用户名'@'登录主机' identified by '密码';
#原始密码为:123456 加密后的密码为:*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
grant all privileges on *.* to 'root'@'%' identified by password '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' with grant option;
#用户通过本地IP访问数据库
grant all privileges on *.* to 'test'@'localhost' identified by '123456';
#用户通过外网IP访问数据库
grant all privileges on *.* to 'test'@'%' identified by '123456';
#刷新权限
flush privileges;
#创建数据库
create database 数据库名;
#删除数据库
drop database 数据库名;
#删除表
drop table 表名;
#删除用户及权限
drop user '用户名'@'localhost';
drop user '用户名'@'%';
#刷新权限
flush privileges;
2)正常登录的命令
mysql -utest -p123456 -P3306 -h192.168.48.129
3)mysql命令找不到
[roadexam@centos7 src]$ mysqls -utest -p123456 -P3306 -h192.168.48.129
bash: mysqls: command not found
4)参数u大写ERROR 1064 (42000)...use near 'st' at line 1
[roadexam@centos7 src]$ mysql -Utest -p123456 -P3306 -h192.168.48.129
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'st' at line 1
5)用户名错误 ERROR 1045 (28000)...Access denied
[roadexam@centos7 src]$ mysql -utest1 -p123456 -P3306 -h192.168.48.129
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'test1'@'192.168.48.129' (using password: YES)
6)P为大写或和密码之间有空格或密码错误 ERROR 1045 (28000)...Access denied
[roadexam@centos7 src]$ mysql -utest -p 123456 -P3306 -h192.168.48.129
Enter password:
ERROR 1045 (28000): Access denied for user 'test'@'192.168.48.129' (using password: NO)
[roadexam@centos7 src]$ mysql -utest -P123456 -P3306 -h192.168.48.129
ERROR 1045 (28000): Access denied for user 'test'@'192.168.48.129' (using password: NO)
[roadexam@centos7 src]$ mysql -utest -p1234567 -P3306 -h192.168.48.129
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'test'@'192.168.48.129' (using password: YES)
7)端口号不对 ERROR 2003 (HY000):Can't connect to MySQL...(111)
[roadexam@centos7 src]$ mysql -utest -p123456 -P3307 -h192.168.48.129
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.48.129' (111)
8)连接数据库的地址不对 ERROR 2003 (HY000): Can't connect to MySQL...(113)
[roadexam@centos7 src]$ mysql -u test -p123456 -P 3306 -h 192.168.48.121
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.48.121' (113)
9)地址中包含端口号信息 ERROR 2005 (HY000): Unknown MySQL...(0)
[roadexam@centos7 src]$ mysql -u test -p123456 -P 3306 -h 192.168.48.129:3306
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2005 (HY000): Unknown MySQL server host '192.168.48.129:3306' (0)
Linux上通过MySQL命令访问MySQL数据库时常见问题汇总的更多相关文章
- Linux系统下授权MySQL账户访问指定数据库和数据库操作
Linux系统下授权MySQL账户访问指定数据库 需求: 1.在MySQL中创建数据库mydata 2.新建MySQL账户admin密码123456 3.赋予账户admin对数据库mydata具有完全 ...
- MySQL命令行导出数据库
MySQL命令行导出数据库:1,进入MySQL目录下的bin文件夹:cd MySQL中到bin文件夹的目录如我输入的命令行:cd C:\Program Files\MySQL\MySQL Server ...
- 文件批量加密重命名--python脚本AND mysql命令行导入数据库
在考试中学生交上来的报告,需要进行一下文件名加密,这样阅卷老师就不知道是谁的报告了 在百度帮助下,完成了加密和解密脚本, 加密 #!/usr/bin/python # -*- coding: utf- ...
- 在linux中使用Sqlplus命令登录MySQL,查看表并设置行数和宽度,使其正常显示
在linux中使用sqlplus命令进入MySQL,设置行数和行宽 1) 查看目前的pagesize,默认是14: 1. show pagesize; 2. set pa ...
- PHP在linux上执行外部命令
PHP在linux上执行外部命令 一.PHP中调用外部命令介绍二.关于安全问题三.关于超时问题四.关于PHP运行linux环境中命令出现的问题 一.PHP中调用外部命令介绍在PHP中调用外部命令,可以 ...
- Linux上的free命令详解、swap机制
Linux上的free命令详解 解释一下Linux上free命令的输出. 下面是free的运行结果,一共有4行.为了方便说明,我加上了列号.这样可以把free的输出看成一个二维数组FO(Free ...
- 在linux上用dd命令实现ghost功能
ghost和g4l 安装操作系统,速度太慢,整个过程太冗长乏味了. 安装过程中,需要回答若干问题,系统需要安装无数个软件,创建和写入无数的文件.因为涉及到大量的文件定位和读写,速度一定是快不起来的. ...
- Apache RocketMQ在linux上的常用命令
Apache RocketMQ在linux上的常用命令 进入maven安装后的rocketmq的bin目录 1.启动Name Server 2.启动Broker 3.关闭Name Server 4 ...
- 在linux上使用impdp命令时提示ORA-12154: TNS:could not resolve the connect identifier specified的问题
今天在一台linux服务器上用impdp命令导入dmp文件时出现了错误: ORA: TNS:could not resolve the connect identifier specified 我使用 ...
随机推荐
- Excel添加水印
Excel添加水印[源码下载] 步骤一:根据生成图片的类创建水印图片 步骤二: 代码在Excel中根据第一行获取sheet的列数[sheet.getRow(0).getLastCellNum() ], ...
- java 原始类与封装类 的区别
int是java提供的8种原始数据类型之一.Java为每个原始类型提供了封装类,Integer是java为int提供的封装类.int的默认值为0,而Integer的默认值为null,即Integer可 ...
- 要把target下面虚拟路径的项目文件…
源码进不去,要检查target下面的项目文件,要删除掉. 版权声明:本文为博主原创文章,未经博主允许不得转载.
- (十七)Spring 集成Quartz
在使用jdk的timer时发现无法满足这次的开发需求:即无法在指定的日期进行执行任务.这便引入一个优秀的开源任务调度框架“quartz”.这里加入的是quartz-1.8.6版本.Quart的官网:h ...
- Do not have XXX handler in current page
这种错误没有什么技术含量,也很容易解决. 一般就是wxml里面的button/form之类的,你用bindtap/bindsubmit给它绑了一个XXX函数,但是呢,你没有在相关js页面里面定义这个函 ...
- "Mysql has gone away"的几种可能
现象: 在本地利用Flask自带的WSGI服务进行调试没有问题后,通过Gunicorn进行部署. 但是在一晚上没有访问之后,第二天再次访问会出现500(Internal error). 原因: 通过追 ...
- Golang : cobra 包简介
Cobra 是一个 Golang 包,它提供了简单的接口来创建命令行程序.同时,Cobra 也是一个应用程序,用来生成应用框架,从而开发以 Cobra 为基础的应用.本文的演示环境为 ubuntu 1 ...
- ApplicationContext的三个常用实现类:
ClassPathXmlApplicationContext 它可以加载类路径下的配置文件,要求配置文件必须在类路径下,不在的话加载不了 (java中获取类路径下资源的方式) FileSystemXm ...
- 脚本执行JavaScript代码
下面是一个具体的demo测试脚本引擎,执行javas文件. package Rhino; import java.io.FileReader;import java.net.URL; import j ...
- Java基础--常用API--字符串相关API
一.java.lang.String 1.string对象不可变,被final修饰,不能被继承. 2.赋值方式: (1)直接赋值.比如: String name = "rick"; ...