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 我使用 ...
随机推荐
- IOS深入学习
iOS超全开源框架.项目和学习资料汇总(1)UI篇 iOS超全开源框架.项目和学习资料汇总(2)动画篇 iOS超全开源框架.项目和学习资料汇总(3)网络和Model篇 数据库 FMDB – sqlit ...
- 7.15实习培训日志 java题解
周末总结 本周主要学习了markdown,git,docker等工具的使用.在本周的学习中,初步了解了markdown,git,docker的使用.本周的静态博客部署中,对于怎么显示一个博客内容,有两 ...
- Gym 101142C CodeCoder vs TopForces (搜索)
题意:每个人有2种排名,对于A只要有一种排名高于B,那么A就能赢B,再如果B能赢C,那么A也能赢C,要求输出每个人分别能赢多少个人 析:首先把题意先读对了,然后我们可以建立一个图,先按第一种排名排序, ...
- CentOS 安装Perl环境
参考博文:https://blog.csdn.net/weixin_40192129/article/details/78610974 vmware tools需要perl环境的支持 安装perl支持 ...
- 51nod1109(bfs)
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1109 题意:中文题诶- 思路:可以用二叉树构建,根节点为 1, ...
- SequoiaDB培训视频
很久之前录制的SequoiaDB培训视频,现在都放上百度云盘了,感兴趣的同学可以看看. 第一讲:图形界面-安装前准备 链接: https://pan.baidu.com/s/1d2B3qUYqtKrE ...
- 安装mongo可视化管理工具mongo admin
https://github.com/mrvautin/adminMongo github地址 安装要求下载下来,然后安装即可 中间出现了问题: 说是开了代理,可以关掉代理之后,然后把下载下来的删了, ...
- shell学习(8)- ulimit调优系统参数
ulimit:显示(或设置)用户可以使用的资源的限制(limit),这限制分为软限制(当前限制)和硬限制(上限),其中硬限制是软限制的上限值,应用程序在运行过程中使用的系统资源不超过相应的软限制,任何 ...
- [HNOI2017]抛硬币
Description 小A和小B是一对好朋友,他们经常一起愉快的玩耍.最近小B沉迷于××师手游,天天刷本,根本无心搞学习.但是已经入坑了几个月,却一次都没有抽到SSR,让他非常怀疑人生.勤勉的小A为 ...
- 长春理工大学第十四届程序设计竞赛(重现赛)L.Homework Stream
链接:https://ac.nowcoder.com/acm/contest/912/L 题意: 作为大珩班尖子生,小r每天有很多作业要完成,例如工图.工图和工图. 很显然,做作业是要有顺序的.作业之 ...