GVKun编程网logo

PHP-Mysql相交结果(php与mysql数据库交互实验)

7

如果您想了解PHP-Mysql相交结果的相关知识,那么本文是一篇不可错过的文章,我们将对php与mysql数据库交互实验进行全面详尽的解释,并且为您提供关于jqueryphpmysql相册批量管理怎么

如果您想了解PHP-Mysql相交结果的相关知识,那么本文是一篇不可错过的文章,我们将对php与mysql数据库交互实验进行全面详尽的解释,并且为您提供关于jquery php mysql相册批量管理怎么实现、linux+tomcat+mysql相关命令_MySQL、mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径,macmysql_PHP教程、mysql学习记录(二十四)--mysql相关工具_MySQL的有价值的信息。

本文目录一览:

PHP-Mysql相交结果(php与mysql数据库交互实验)

PHP-Mysql相交结果(php与mysql数据库交互实验)

我正在尝试做类似PHP array_intersect的操作.我有下表

CREATE TABLE `recipes_ingredients_items` (
  `id` INTEGER(11) DEFAULT NULL,
  `itemid` INTEGER(11) DEFAULT NULL,
  `orderby` tinyint(4) NOT NULL,
  KEY `id` (`id`),
  KEY `itemid` (`itemid`)
)ENGINE=MyISAM
AVG_ROW_LENGTH=47 CHaraCTER SET 'utf8' COLLATE 'utf8_general_ci';  

我需要一个查询,该查询将使我得到所有包含说ID 2,72,64作为不同itemid的结果.问题是,一个id在itemid中可能不止一次存在,即itemid 600可能有3行与ID相关的ID为2、100、2.
我的想法是用x数o子查询进行查询,以返回结果并执行类似PHP array_intersect的操作,从而返回具有所有这些ID的itemid.

SELECT disTINCT itemid  FROM recipes_ingredients_items
WHERE 
id IN (SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 71) 
AND 
id IN (SELECT disTINCT  itemid FROM recipes_ingredients_items WHERE id = 2)
AND 
id IN (SELECT disTINCT  itemid FROM recipes_ingredients_items WHERE id = 22)

这就是我得到的,这是100%错误的.

解决方法:

通常,您需要对每个id的itemid做一个交集:

(SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 71)
INTERSECT
(SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 2)
INTERSECT
(SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 22)

这只会选择所有三个id都有一个id的那些itemid.

但是由于MysqL不支持INTERSECT,因此您需要使用内部联接:

SELECT disTINCT itemid FROM recipes_ingredients_items
INNER JOIN (SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 71) a USING (itemid)
INNER JOIN (SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 2) b USING (itemid)
INNER JOIN (SELECT disTINCT itemid FROM recipes_ingredients_items WHERE id = 22) c USING (itemid)

jquery php mysql相册批量管理怎么实现

jquery php mysql相册批量管理怎么实现

Jquery php mysql做个相册管理系统,已经用第三方插件实现了相片的上传和现实,现在想做一个像人人网那样的批量管理,批量删除,修改title什么的,比如点击批量删除会弹出一个框框里面全是缩略图,可以批量勾选,然后点击删除按钮,然后确认删除。有没有现成的库?求大牛给方向。

linux+tomcat+mysql相关命令_MySQL

linux+tomcat+mysql相关命令_MySQL

备份数据库:

mysqldump -u root -p 数据库名>sql文件所在的路径(例:/soft/bak/mysqlbak/xx201508242248.sql)

备份项目:

即:将tomcat的root文件夹下的所有文件备份到新文件夹中

cp 空格-rf空格 源文件夹 空格 目标文件夹

点击下载“修复打印机驱动工具”;

例:cp -rf soft/apache-tomcat-7.0.59/webapps/ROOT/ soft/bak/xxbak/bak_201508242248

将sql文件导入到mysql数据库:

1、mysql -u root -p

2、mysql>use 数据库名称;

3、mysql>source sql文件的路径全名

导入成功后用此命令查看表:mysql>describe 表名;

查看mysql字符集:show variables like ''character%'';

退出mysql:mysql>quit;

新建文件夹:mkdir -p 文件夹名称

进入一级:cd /xx/xx

退出一级:cd ../

退出两级:cd ../..

查看目录中文件:ls

查看tomcat控制台打印日志:

1、cd /soft/apache-tomcat-7.0.59/logs回车

2、tail -f catalina.logs



mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径,macmysql_PHP教程

mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径,macmysql_PHP教程

mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径,macmysql

首先去官网下载: http://www.mysql.com/downloads/

我下载了5.6.11的dmg然后安装,安装完成之后..如果要用终端去玩SQL.那么一开始要输入很长的:/usr/local/mysql/bin/mysql

这不方便啊,好想像windows下的cmd里面一样输入mysql -uroot -p1这样...上网查了下..可以实现滴.

打开终端,输入: 

1)alias mysql=/usr/local/mysql/bin/mysql

2)alias mysqladmin=/usr/local/mysql/bin/mysqladmin

执行完之后就可以想windows一样操作了.

第二个是设置密码的

我们可以输入:mysqladmin -u root password  

在终端下开启MySQL和关闭:

sudo /Library/StartupItems/MySQLCOM/MYSQLCOM [start | stop | restart]

不过我们安装包里面有

MySQL_StartupItem.pkg 

MySQL.prefPane     

安装好之后.在系统偏好设置就会有mysql了.........

 

ps:补充上面的alias方法..如果按照上面执行..那么关闭了终端再开就无效了.想要长期有效果.就要修改文件.让终端启动的时候加载.

在终端输入 : cd ~

vim ./bash_profile

这个文件如果配置过android开发环境是修改过的.我们添加2行

alias mysql=/usr/local/mysql/bin/mysql

alias mysqladmin=/usr/local/mysql/bin/mysqladmin

保存退出,重启终端或者开新窗口即可

 

alias指令:设置命令别名

alias: usage: alias [-p] [name[=value] ... ]

1. 语法   

alias [参数][命令别名]=[原命令名称]

 

2. 功能介绍

该指令主要用于为原命令定义新的别名,以便书写或者记忆。

3. 参数说明

参数 功能说明

-p

向标准输出设备发送已经存在的命令别名

[命令别名]=[原命令名称]

定义命令别名,即使用“别名”代替“原命令名称”,但最终实际使用到的命令仍然是原命令 

4.示例

4.1 设置命令别名

在ubuntu下,我们会经常使用命令

ll

来代替命令 

ls -al

但是在mac中没有这个命令。于是我们便利用alias来实现这个功能,并且添加上其他的参数让我们更加方便使用。执行命令

<span>#</span><span> 为了方便看文件或者目录的大小,加多一个参数h</span><span>
#</span><span> 参数说明:</span><span>
#</span><span> a-显示隐藏文件</span><span>
#</span><span> l-显示文件的详细信息</span><span>
#</span><span> h-以适合的单位进行文件或者目录大小的显示</span>
alias ll=''ls -alh''
登录后复制

命令执行完毕后,我们执行一次ll进行尝试,控制台输出如下:

kevin@uc:~/Downloads/<span>mac$ ll

total 173M

drwxrwxr</span>-x 2 kevin kevin 4.0K 9月 25 16:20 .<span>

drwxr</span>-xr-x 8 kevin kevin 4.0K 9月 29 13:59 ..

-rw-rw-r-- 1 kevin kevin 150M 9月 25 16:20 Navicat Premium <span>for</span> Mac 11.0.20 中文版.<span>dmg

</span>-rw-rw-r-- 1 kevin kevin   26 9月 25 16:20 Navicat Premium <span>for</span> Mac 11.0.20 中文版.dmg:Zone.<span>Identifier

</span>-rw-rw-r-- 1 kevin kevin  12M 9月 3 10:35 synergy-1.5.1-r2398-MacOSX108-x86_64.<span>dmg

</span>-rw-rw-r-- 1 kevin kevin  12M 9月 3 10:36 synergy-1.5.1-r2398-MacOSX109-x86_64.dmg
登录后复制

4.2 显示已经存在的命令别名列表 

alias -p 

控制台将会输出如下结果:

kevin@uc:~$ alias -p

alias ll=''ls -alh''

5. 经验技巧

使用该指令可以将一些较长的命令进行简化。

使用该指令时,用户必须使用单引号'' ''将原来的命令引起来,防止特殊字符导致错误。

该指令的作用只局限于该次登入的操作。若要每次登入都能够使用这些命令别名,则可将相应的alias命令存放到bash的初始化文件"~/.bash_profile"中。

6.查看命令别名的原始命令

要获得命令别名的原始命令,则可以通过指令"type"实现,输入如下命令: 

type ll #显示命令别名的原始命令

控制台将会输出: 

ll is aliased to `ls -alh''

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1048742.htmlTechArticlemac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径,macmysql 首先去官网下载: http://www.mysql.com/downloads/ 我下载了5.6.11的dmg然后安装,安装...

mysql学习记录(二十四)--mysql相关工具_MySQL

mysql学习记录(二十四)--mysql相关工具_MySQL

一、理论:
1.mysql:客户端连接工具
a.-u:指定用户名
b.-p:指定密码
c.-host:指定服务器IP或者域名
d.-P:指定连接端口
e.--default-character-set:客户端字符集选项
f.-e:执行选项
g.-E:将输出方式按照字段顺序显示
h.-f:强制执行sql
i.-v:显示更多信息
2.myisampack:myisam表压缩工具
3.mysqladmin:mysql管理工具
4.mysqlbinlog:日志管理工具
a.-d:指定数据库名称,只列出指定的数据库相关操作
b.-o:忽略掉日志中的前n行命令
c.-r:将输出的文本格式日志输出到指定文件
d.-s:显示简单格式,省略掉一些信息
e.--set-charset=char-name:在输出为文本格式时,在文件第一行上加上set names char-nam(可用于装载数据)
f.--start-datetime=name:指定日期间隔内的所有日志
g.--start-position:指定位置间隔内的所有日志
5.mysqlcheck:MyISAM表维护工具
a.-c:检查表
b.-r:修复表
c.-a:分析表
d.-o:优化表
6.mysqldump:数据导出工具
a.-u:用户名
b.-p:密码
c.-h:服务器IP或者域名
d.-P:连接端口
e.--add-drop-database:每个数据库创建语句前加上drop database
f.--add-drop-table:在每个表创建语句前加上drop table
g.-n:不包含数据库的创建语句
h.-t:不包含数据表的创建语句
i.-d:不包含数据
j.--compact:不包含默认选项中的各种注释
7.mysqlhostcopy:MyISAM表热备份工具
8.mysqlimport:数据导入工具
9.mysqlshow:数据库对象查看工具
10.perror:错误代码查看工具

11.replace:文本替换工具

二、实践:

 

abc@ubuntu:~$ mysql -uroot -p(密码) --default-character-set=utf8
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement.

mysql> show variables like &#39;char%&#39;;
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8                             |
| character_set_connection | utf8                             |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | utf8                             |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> show variables like &#39;char%&#39;;Ctrl-C -- exit!
Aborted
abc@ubuntu:~$ mysql -uroot -p(密码) --default-character-set=gbk;
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement.

mysql> show variables like &#39;char%&#39;;
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | gbk                              |
| character_set_connection | gbk                              |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | gbk                              |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> Ctrl-C -- exit!
Aborted
abc@ubuntu:~$ mysql -uroot -p(密码);
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement.

mysql> use sakila;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

abc@ubuntu:~$ mysql -uroot -p(密码) -e &#39;use sakila;select * from payment limit 5;&#39;;
+------------+-------------+----------+-----------+--------+---------------------+---------------------+
| payment_id | customer_id | staff_id | rental_id | amount | payment_date        | last_update         |
+------------+-------------+----------+-----------+--------+---------------------+---------------------+
|          1 |           1 |        1 |        76 |   2.99 | 2005-05-25 11:30:37 | 2006-02-15 22:12:30 |
|          2 |           1 |        1 |       573 |   0.99 | 2005-05-28 10:35:23 | 2006-02-15 22:12:30 |
|          3 |           1 |        1 |      1185 |   5.99 | 2005-06-15 00:54:12 | 2006-02-15 22:12:30 |
|          4 |           1 |        2 |      1422 |   0.99 | 2005-06-15 18:02:53 | 2006-02-15 22:12:30 |
|          5 |           1 |        2 |      1476 |   9.99 | 2005-06-15 21:08:46 | 2006-02-15 22:12:30 |
+------------+-------------+----------+-----------+--------+---------------------+---------------------+
abc@ubuntu:~$ mysql -uroot -p(密码) -e &#39;use sakila;select * from payment limit 5;&#39; -E;
*************************** 1. row ***************************
  payment_id: 1
 customer_id: 1
    staff_id: 1
   rental_id: 76
      amount: 2.99
payment_date: 2005-05-25 11:30:37
 last_update: 2006-02-15 22:12:30
*************************** 2. row ***************************
  payment_id: 2
 customer_id: 1
    staff_id: 1
   rental_id: 573
      amount: 0.99
payment_date: 2005-05-28 10:35:23
 last_update: 2006-02-15 22:12:30
*************************** 3. row ***************************
  payment_id: 3
 customer_id: 1
    staff_id: 1
   rental_id: 1185
      amount: 5.99
payment_date: 2005-06-15 00:54:12
 last_update: 2006-02-15 22:12:30
*************************** 4. row ***************************
  payment_id: 4
 customer_id: 1
    staff_id: 2
   rental_id: 1422
      amount: 0.99
payment_date: 2005-06-15 18:02:53
 last_update: 2006-02-15 22:12:30
*************************** 5. row ***************************
  payment_id: 5
 customer_id: 1
    staff_id: 2
   rental_id: 1476
      amount: 9.99
payment_date: 2005-06-15 21:08:46
 last_update: 2006-02-15 22:12:30
abc@ubuntu:~$ cd ~/Downloads/
abc@ubuntu:~/Downloads$ mkdir mysql
abc@ubuntu:~/Downloads$ cd mysql/
abc@ubuntu:~/Downloads/mysql$ vi a.sql;
(在此步添加了一些内容)
abc@ubuntu:~/Downloads/mysql$ more a.sql;
insert into t2 values (1);
insert into t2 values (2222222222222222222222222);
insert into t2 values (3);
abc@ubuntu:~/Downloads/mysql$ mysql -uroot -p(密码);
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 53
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement.

mysql> use test;
Database changed
mysql> create table t2(
    -> id int(11)
    -> ) engine = innodb charset = utf8;
Query OK, 0 rows affected (0.05 sec)

mysql> Ctrl-C -- exit!
Aborted
abc@ubuntu:~/Downloads/mysql$ mysql -uroot -p(密码) test < a.sql;
ERROR 1054 (42S22) at line 2: Unknown column &#39;2a&#39; in &#39;field list&#39;
abc@ubuntu:~/Downloads/mysql$ mysql -uroot -p(密码) test -e &#39;select * from t2&#39;;
+------+
| id   |
+------+
|    1 |
+------+
abc@ubuntu:~/Downloads/mysql$ mysql -uroot -p(密码) test -f < a.sql 
ERROR 1054 (42S22) at line 2: Unknown column &#39;2a&#39; in &#39;field list&#39;
abc@ubuntu:~/Downloads/mysql$ mysql -uroot -p(密码) test -e &#39;select * from t2&#39;;
+------+
| id   |
+------+
|    1 |
|    3 |
+------+
abc@ubuntu:~/Downloads/mysql$ mysql -uroot -p(密码) test -f -v ~/test.txt;
abc@ubuntu:/usr/local/mysql/bin$ cd ~/
abc@ubuntu:~$ more ~/test.txt 
-- MySQL dump 10.13  Distrib 5.5.44, for Linux (x86_64)
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version 5.5.44-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE=&#39;+00:00&#39; */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=&#39;NO_AUTO_VALUE_ON_ZERO&#39; */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `t2`
--

DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t2`
--

LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2015-11-06  5:15:01
abc@ubuntu:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact -d test t2 > ~/Downloads//t2.txt
abc@ubuntu:/usr/local/mysql/bin$ more ~/Downloads/t2.txt;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
abc@ubuntu:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact -c test t2 > ~/Downloads/t2c.txt
abc@ubuntu:/usr/local/mysql/bin$ more ~/Downloads/t2c.txt
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` (`id`) VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);

abc@ubuntu:/usr/local/mysql/bin$ mysqld --verbose --help | grep &#39;default-character-set&#39; | grep -v name ;
151106  5:18:52 [Warning] option &#39;table_definition_cache&#39;: unsigned value 100 adjusted to 400
151106  5:18:52 [Note] mysqld (mysqld 5.5.44-log) starting as process 74255 ...
151106  5:18:52 [Warning] Can&#39;t create test file /usr/local/mysql/data/ubuntu.lower-test
151106  5:18:52 [Warning] Can&#39;t create test file /usr/local/mysql/data/ubuntu.lower-test
151106  5:18:52 [Warning] One can only use the --user switch if running as root

mysqld: File &#39;/usr/local/mysql/data/mysql-bin.index&#39; not found (Errcode: 13)
151106  5:18:52 [ERROR] Aborting

abc@ubuntu:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact test t2 > ~/Downloads/testA.txt
abc@ubuntu:/usr/local/mysql/bin$ more ~/Downloads/testA.txt 
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);
abc@ubuntu:/usr/local/mysql/bin$ mysqldump -uroot -p(密码) --compact --default-character-set=latin1 test t2 > ~/Downloads/testA.txt
abc@ubuntu:/usr/local/mysql/bin$ more ~/Downloads/testA.txt 
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);

abc@ubuntu:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码);
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| test               |
| test1              |
+--------------------+
abc@ubuntu:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码) --count;
+--------------------+--------+--------------+
|     Databases      | Tables |  Total Rows  |
+--------------------+--------+--------------+
| information_schema |     40 |        20863 |
| mysql              |     24 |         2214 |
| performance_schema |     17 |           14 |
| sakila             |     33 |        50132 |
| test               |      1 |           13 |
| test1              |     20 |           67 |
+--------------------+--------+--------------+
6 rows in set.
abc@ubuntu:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码) test --count;
Database: test
+--------+----------+------------+
| Tables | Columns  | Total Rows |
+--------+----------+------------+
| t2     |        1 |         13 |
+--------+----------+------------+
1 row in set.

abc@ubuntu:/usr/local/mysql/bin$ mysqlshow -uroot -p(密码) test a --count;
mysqlshow: Cannot get record count for db: test, table: a: Table &#39;test.a&#39; doesn&#39;t exist
abc@ubuntu:~/Downloads$ more t2c.txt
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t2` (`id`) VALUES (1),(3),(1),(3),(1),(2147483647),(3),(1),(2147483647),(3),(1),(2147483647),(3);
abc@ubuntu:~/Downloads$ mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| test               |
+--------------------+
abc@ubuntu:~/Downloads$ mysqlshow -uroot -p(密码) test t2 --count;
Database: test  Table: t2  Rows: 13
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type    | Collation | Null | Key | Default | Extra | Privileges                      | Comment |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| id    | int(11) |           | YES  |     |         |       | select,insert,update,references |         |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
abc@ubuntu:~/Downloads$ mysql -uroot -p(密码);
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 88
Server version: 5.5.44-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement.

mysql> use sakila;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
abc@ubuntu:~/Downloads$ mysqlshow -uroot -p(密码) test t2 -k;
Database: test  Table: t2
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type    | Collation | Null | Key | Default | Extra | Privileges                      | Comment |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| id    | int(11) |           | YES  |     |         |       | select,insert,update,references |         |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
Table has no keys
abc@ubuntu:~/Downloads$ mysqlshow -uroot -p(密码) sakila actor -k;
Database: sakila  Table: actor
+-------------+----------------------+-----------------+------+-----+-------------------+-----------------------------+---------------------------------+---------+
| Field       | Type                 | Collation       | Null | Key | Default           | Extra                       | Privileges                      | Comment |
+-------------+----------------------+-----------------+------+-----+-------------------+-----------------------------+---------------------------------+---------+
| actor_id    | smallint(5) unsigned |                 | NO   | PRI |                   | auto_increment              | select,insert,update,references |         |
| first_name  | varchar(45)          | utf8_general_ci | NO   |     |                   |                             | select,insert,update,references |         |
| last_name   | varchar(45)          | utf8_general_ci | NO   | MUL |                   |                             | select,insert,update,references |         |
| last_update | timestamp            |                 | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | select,insert,update,references |         |
+-------------+----------------------+-----------------+------+-----+-------------------+-----------------------------+---------------------------------+---------+
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name            | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| actor | 0          | PRIMARY             | 1            | actor_id    | A         | 201         |          |        |      | BTREE      |         |               |
| actor | 1          | idx_actor_last_name | 1            | last_name   | A         | 201         |          |        |      | BTREE      |         |               |
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+</a.sql>
登录后复制

我们今天的关于PHP-Mysql相交结果php与mysql数据库交互实验的分享已经告一段落,感谢您的关注,如果您想了解更多关于jquery php mysql相册批量管理怎么实现、linux+tomcat+mysql相关命令_MySQL、mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径,macmysql_PHP教程、mysql学习记录(二十四)--mysql相关工具_MySQL的相关信息,请在本站查询。

本文标签: