在cmd命令行下给mysql表中添加字段报错

犇仐 2017-06-06 08:49:10
我写的语句没毛病吧在cmd命令行中
'alert table student age int(11) not null default '0';
ERROR 1064 (42000): 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 'alert
table student age int(11) not null default '0'' at line 1
...全文
444 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluetata 2017-06-07
  • 打赏
  • 举报
回复
LZ 的 ‘0’变成字符串了~~~~ int值 0 就可以了
二月十六 2017-06-06
  • 打赏
  • 举报
回复
alert table student add age int(11) not null default  0 ;
0与1之间 2017-06-06
  • 打赏
  • 举报
回复
alert table student add age int not null default 0
资源下载链接为: https://pan.quark.cn/s/d9ef5828b597 当在服务器中选择“server only”模式安装 MySQL 之后,使用 Navicat for MySQL 进行远程连接时,可能会出现“Host 主机名 is not allowed to connect the mysql server”这样的报错提示。出现这一问题的原因在于没有为 MySQL 授权远程访问权限。 解决这一问题的方法如下:首先,打开命令提示符(cmd)。接着,尝试运行命令“mysql -u root -p”。如果此时出现“mysql 不是内部或外部命令”的报错信息,那么需要找到 MySQL 安装对应的 bin 文件夹,直接运行其中的 mysql.exe 文件。如果在运行 mysql.exe 时出现闪退的情况,那么可以先在 cmd 中运行“cd 路径/bin”,将路径替换为 MySQL 安装 bin 文件夹的实际路径,然后再运行 mysql.exe。 成功进入 MySQL 命令行界面后,先执行“use mysql;”命令,切换到 mysql 数据库。之后,运行“select host from user where user=’root’;”这条命令,查看当前 root 用户的 host 字段值,了解其是否允许远程访问。最后,执行“update user set host =’%’ where user =’root’;”命令,将 root 用户的 host 字段值修改为“%”,表示允许从任何主机访问 MySQL 服务器。完成上述操作后,再尝试使用 Navicat for MySQL 进行远程连接,应该就可以正常连接到 MySQL 服务器了。

672

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧