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 我使用 ...
随机推荐
- 连接Oracle数据库的Hibernate配置…
连接Oracle数据库的Hibernate配置文件 连接Oracle的Hibernate配置文件有两种格式,一种是xml格式的,另一种是Java属性文件格式的.下面分别给出这两种格式配置文件的代码. ...
- SpringBoot使用拦截器无效
附上代码: public class WendaWebConfiguration extends WebMvcConfigurerAdapter { @Autowired PassportInterc ...
- 附近wifi都是你的
今天给大家介绍deauth攻击. 最终效果:附近你指定的任何wifi,别人都无法连接,即便连接上的也会断掉. 由于我在 “世界虽大,但没有破不了的wifi” 这篇文章中写的很详细,所以我在这里就步详 ...
- metasploit msfconsole 命令
metasploit msfconsole 命令 msf > help db_autopwn Commands =================== Command Description - ...
- DSOFramer控件使用注意事项
1.引用dll==>AxInterop.DSOFramer.dll ==>Interop.DSOFramer.dll ==>WindowsFormsIntegration ==> ...
- exporting
exporting: { buttons: { contextButton: { menuItems: [{ text: '导出png图片 100宽度', onclick: function () { ...
- npm ERR! Cannot read property 'match' of undefined 错误处理
跟往常一样运行npm install 的时候,突然报错.错误情况如下: npm ERR! Cannot read property 'match' of undefined npm ERR! A co ...
- 苦逼三流小公司程序员这半年找工作经历(3)——选择offer
本文按照企业规模.性质.规模,分成三类,点评一下遇到的这些公司.也算是为半年找工作经历的一个总结. 1,三流小公司 公司规模类似于笔者跳槽前所在企业,性质有外商独资.合资,当然大多数都是民营企业,规模 ...
- 731. My Calendar II
Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event w ...
- 2014 Noip提高组 Day1
P1328 生活大爆炸版石头剪刀布 [题目描述] 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头 ...