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 我使用 ...
随机推荐
- 一步步实现 Prism + MEF(一)--- 搭建框架
第一步:构建一个名为Bootstrapper的类作为引导程序. class Bootstrapper : MefBootstrapper { } 第二步:在MainWindow窗体中添加一个Coont ...
- OpenType字体与TrueType字体的区别
TrueType采用几何学中二次B样条曲线及直线来描述字体的外形轮廓,其特点是:TrueType既可以作打印字体,又可以用作屏幕显示:由于它是由指令对字形进行描述,因此它与分辨率无关,输出时总是按照打 ...
- 一文带你认识Java8中接口的默认方法
Java8是Oracle于2014年3月发布的一个重要版本,其API在现存的接口上引入了非常多的新方法. 例如,Java8的List接口新增了sort方法.在Java8之前,则每个实现了List接口的 ...
- SCUT - 157 - CC和他的GCD - 容斥原理
https://scut.online/p/157 鉴于多年(都没几个月)搞数论的经验,这种时候枚举g肯定是对的. 那么肯定是要莫比乌斯函数作为因子,因为很显然? 但是为什么要搞个负的呢?其实是因为这 ...
- uoj#401. 【CTSC2018】青蕈领主(分治FFT)
传送门 话说分治\(FFT\)是个啥子啊--还有题目里那字好像念(蕈xùn) 首先考虑无解的情况:区间相交或者\(L_n\neq n\) 这两个都可以感性理解一下 所以区间之间只会有包含关系,我们把每 ...
- 阿里云服务器新手安装nginx
1.域名购买之后 备案. 2.购买服务器. 3.这两个条件具备之后进行下一步. 本人使用Mac ,实践流程按照Mac本的流程操作. 作为初学者,简配的服务器, 实例类型: I/O优化,操作系统: Ce ...
- pytest框架(一)
代码示例一 # coding=utf-8 def func(x): return x + 1 def test_answer(): assert func(3) == 5 运行结果 E:\pyYouY ...
- [转]监控常用TCODE
1 系统监视 1.1 进程监视 SM66/SM50 进程查看 管理员需全天监看系统的进程.长时间运行的后台工作,有缺陷的报表程序,若不进行控制都将消耗掉大量的系统资源.管理员用这个事务码检查他们的环 ...
- MyBatis入门Bug集锦X1
- CodeForces - 361A-Levko and Table (思维)
Levko loves tables that consist of n rows and n columns very much. He especially loves beautiful tab ...