您的位置:首页 > 数据库 > MySQL

mysql的粗略学习

2014-11-08 19:44 106 查看
输入root进入mysql

试着输入了两个语法都没动静,输入\h终于有反应了

语法错误

show databases; //显示数据库

为什么没有人告诉我还有个英文下的分隔符号。。。

查的资料不是没有就是汉语的符号。。。

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| my_db |
| mysql |
| performance_schema |
| shopdata |
| think |
| thinkphp |
| wenzhang |
+--------------------+
8 rows in set (0.05 sec)

炒大米。。。味道不错。。。

我想看看shopdata这个数据库里都有些什么表

mysql> use shopdata;
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_shopdata |
+----------------------------+
| ecs_account_log |
| ecs_ad |
| ecs_ad_custom |
| ecs_ad_position |
| ecs_admin_action |
| ecs_admin_log |
| ecs_admin_message |
| ecs_admin_user |
| ecs_adsense |
| ecs_affiliate_log |
| ecs_agency |
| ecs_area_region |
| ecs_article |
| ecs_article_cat |
| ecs_attribute |
| ecs_auction_log |
| ecs_auto_manage |
| ecs_back_goods |
| ecs_back_order |
| ecs_bonus_type |
| ecs_booking_goods |
| ecs_brand |
| ecs_card |
| ecs_cart |
| ecs_cat_recommend |
| ecs_category |
| ecs_collect_goods |
| ecs_comment |
| ecs_crons |
| ecs_delivery_goods |
| ecs_delivery_order |
| ecs_email_list |
| ecs_email_sendlist |
| ecs_error_log |
| ecs_exchange_goods |
| ecs_favourable_activity |
| ecs_feedback |
| ecs_friend_link |
| ecs_goods |
| ecs_goods_activity |
| ecs_goods_article |
| ecs_goods_attr |
| ecs_goods_cat |
| ecs_goods_gallery |
| ecs_goods_type |
| ecs_group_goods |
| ecs_keywords |
| ecs_link_goods |
| ecs_mail_templates |
| ecs_member_price |
| ecs_nav |
| ecs_order_action |
| ecs_order_goods |
| ecs_order_info |
| ecs_pack |
| ecs_package_goods |
| ecs_pay_log |
| ecs_payment |
| ecs_plugins |
| ecs_products |
| ecs_reg_extend_info |
| ecs_reg_fields |
| ecs_region |
| ecs_role |
| ecs_searchengine |
| ecs_sessions |
| ecs_sessions_data |
| ecs_shipping |
| ecs_shipping_area |
| ecs_shop_config |
| ecs_snatch_log |
| ecs_stats |
| ecs_suppliers |
| ecs_tag |
| ecs_template |
| ecs_topic |
| ecs_user_account |
| ecs_user_address |
| ecs_user_bonus |
| ecs_user_feed |
| ecs_user_rank |
| ecs_users |
| ecs_virtual_card |
| ecs_volume_price |
| ecs_vote |
| ecs_vote_log |
| ecs_vote_option |
| ecs_wholesale |
| jindong_ad |
| jindong_ad_position |
| jindong_template |
| mc_action |
| mc_attached |
| mc_meta |
| mc_option |
| mc_page |
| shopdatacommentmeta |
| shopdatacomments |
| shopdatalinks |
| shopdataoptions |
| shopdatapostmeta |
| shopdataposts |
| shopdataterm_relationships |
| shopdataterm_taxonomy |
| shopdataterms |
| shopdatausermeta |
| shopdatausers |
| shopdatawfbadleechers |
| shopdatawfblocks |
| shopdatawfblocksadv |
| shopdatawfconfig |
| shopdatawfcrawlers |
| shopdatawffilemods |
| shopdatawfhits |
| shopdatawfhoover |
| shopdatawfissues |
| shopdatawfleechers |
| shopdatawflockedout |
| shopdatawflocs |
| shopdatawflogins |
| shopdatawfnet404s |
| shopdatawfreversecache |
| shopdatawfscanners |
| shopdatawfstatus |
| shopdatawfthrottlelog |
| shopdatawfvulnscanners |
+----------------------------+
126 rows in set (0.00 sec)

mysql>

换一个

mysql> use thinkphp;
Database changed
mysql> show tables;
+--------------------+
| Tables_in_thinkphp |
+--------------------+
| think_data |
+--------------------+
1 row in set (0.00 sec)

mysql>

查看think_data表里有几个列,都是写什么

mysql> desc think_data;
+-------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------+------+-----+---------+----------------+
| id | int(8) unsigned | NO | PRI | NULL | auto_increment |
| data | varchar(255) | NO | | NULL | |
+-------+-----------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)

mysql>

查看列中具体有哪些数据,语法从phpadmin里找到的。。。

mysql> SELECT * FROM `think_data`;
+----+-----------+
| id | data |
+----+-----------+
| 1 | thinkphp |
| 2 | php |
| 3 | framework |
+----+-----------+
3 rows in set (0.00 sec)

mysql>

大概就是这么个结构了。。。

如何建立一个utf8数据库?

mysql> CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| confluence |
| my_db |
| mysql |
| performance_schema |
| shopdata |
| think |
| thinkphp |
| wenzhang |
+--------------------+
9 rows in set (0.00 sec)

mysql>

百度一下

character[英]ˈkærəktə(r)[美]ˈkærəktɚ
n.性格;特点;字母;角色
vt.刻,印;使具有特征

collate

[英][kə'leɪt][美][kəˈlet, ˈkɑlˌet, ˈkoˌlet]

vt.核对,校对(书、底稿等); (装钉)整理,检查; [宗]委任牧师职;

角色这个单词好像学过,校对就完全没有映像了。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: