老男孩mysql练习题自我学习

  1. 登陆数据库

    [email protected] ~]#mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.5.38 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2014, 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.
    
    [[email protected] ~]#mysql -u root -p123456
    
    Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
  2. 查看数据库版本及当前登陆用户是什么
    mysql> select version();
    +-----------+
    | version() |
    +-----------+
    | 5.5.38    |
    +-----------+
    1 row in set (0.00 sec)
    
    mysql> select user();
    +----------------+
    | user()         |
    +----------------+
    | [email protected] |
    +----------------+
    1 row in set (0.00 sec)
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | activiti_test      |
    | monitor            |
    | mysql              |
    | osa                |
    | osa_guard          |
    | sms                |
    | test               |
    | yandi_monitor      |
    +--------------------+
  3. 创建GBK字符集的数据库inline,并查看已建库的完整语句。
    mysql> create database inline default charset gbk;
    Query OK, 1 row affected (0.01 sec)
    
    mysql> show create database inline;
    +----------+----------------------------------------------------------------+
    | Database | Create Database                                                |
    +----------+----------------------------------------------------------------+
    | inline   | CREATE DATABASE `inline` /*!40100 DEFAULT CHARACTER SET gbk */ |
    +----------+----------------------------------------------------------------+
    1 row in set (0.00 sec)
  4. 创建用户inline,使之可以管理数据库inline;
    mysql> grant all on inline.* to [email protected] identified by ‘inline‘;
    Query OK, 0 rows affected (0.00 sec)
  5. 查看创建用户inline拥有哪些权限
    mysql> show grants for [email protected];
    +---------------------------------------------------------------------------------------------------------------+
    | Grants for [email protected]                                                                                   |
    +---------------------------------------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO ‘inline‘@‘localhost‘ IDENTIFIED BY PASSWORD ‘*49129FD3218473FFCCE66D799E25FB6AFD6E0A73‘ |
    | GRANT ALL PRIVILEGES ON `inline`.* TO ‘inline‘@‘localhost‘                                                    |
    +---------------------------------------------------------------------------------------------------------------+
    2 rows in set (0.00 sec)
  6. 进入inline数据库:
    mysql> use inline
    Database changed
  7. 创建一innodb引擎字符集为GBK表test,字段id和name varchar(16),查看建表结构及SQL语句
    mysql> create table test(
        -> id int,
        -> name varchar(16))
        -> engine innodb default charset gbk;
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> show create table test;
    +-------+--------------------------------------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                                                             |
    +-------+--------------------------------------------------------------------------------------------------------------------------+
    | test  | CREATE TABLE `test` (
      `id` int(11) DEFAULT NULL,
      `name` varchar(16) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=gbk |
    +-------+--------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> show variables like ‘char%‘;
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | utf8                       |
    | character_set_connection | utf8                       |
    | character_set_database   | gbk                        |
    | character_set_filesystem | binary                     |
    | character_set_results    | utf8                       |
    | character_set_server     | latin1                     |
    | character_set_system     | utf8                       |
    | character_sets_dir       | /usr/share/mysql/charsets/ |
    +--------------------------+----------------------------+
    8 rows in set (0.00 sec)
    
    mysql> desc test
        -> ;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type        | Null | Key | Default | Extra |
    +-------+-------------+------+-----+---------+-------+
    | id    | int(11)     | YES  |     | NULL    |       |
    | name  | varchar(16) | YES  |     | NULL    |       |
    +-------+-------------+------+-----+---------+-------+
    2 rows in set (0.01 sec)
  8. 插入一条数据:
    mysql> insert into test value(0,‘inlineuser‘);
    Query OK, 1 row affected (0.00 sec)
  9. 批量插入数据,要求中文不能为乱码
    mysql> insert into test value(1,‘inlineuser‘),(2,‘中文‘);
    Query OK, 2 rows affected (0.02 sec)
    Records: 2  Duplicates: 0  Warnings: 0
  10. 查询插入的所有记录
    mysql> ?select * from test;
    +------+------------+
    | id   | name       |
    +------+------------+
    |    0 | inlineuser |
    |    1 | inlineuser |
    |    2 | 中文       |
    +------+------------+
    3 rows in set (0.00 sec)
  11. 查询id大于1的记录
    mysql> select * from test where id>1;
    +------+--------+
    | id   | name   |
    +------+--------+
    |    2 | 中文   |
    +------+--------+
    1 row in set (0.00 sec)
  12. 更新id=1的记录
    ysql> update test set name=‘inuser‘ where id=1;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> select * from test;
    +------+--------------+
    | id   | name         |
    +------+--------------+
    |    0 | inlineuser   |
    |    1 | inuser |
    |    2 | 中文         |
    +------+--------------+
    3 rows in set (0.00 sec)
  13. 在字段name前插入age字段,类型int(4)
    mysql> alter table test add age int(4) after id;
    Query OK, 3 rows affected (0.01 sec)
    Records: 3  Duplicates: 0  Warnings: 0
    
    mysql> desc test;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type        | Null | Key | Default | Extra |
    +-------+-------------+------+-----+---------+-------+
    | id    | int(11)     | YES  |     | NULL    |       |
    | age   | int(4)      | YES  |     | NULL    |       |
    | name  | varchar(16) | YES  |     | NULL    |       |
    +-------+-------------+------+-----+---------+-------+
    3 rows in set (0.00 sec)
    
    mysql>
  14. 备份inline数据库及mysql数据库
    [[email protected] ~]#mysqldump -B inline,mysql >/tmp/backup.sqlmysqldump: Got error: 1049: Unknown database ‘inline,mysql‘ when selecting the database
    [[email protected] ~]#mysqldump -B inline mysql >/tmp/backup.sql
    -- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
    [[email protected] ~]#mysqldump --events -B inline mysql >/tmp/backup.sql
  15. 删除表中的所有数据。
    mysql> delete from test;
    Query OK, 3 rows affected (0.02 sec)
  16. 恢复数据
    [[email protected] ~]#vim /tmp/backup.sql
    [[email protected] ~]#mysql </tmp/backup.sql
    [[email protected] ~]#mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 10
    Server version: 5.5.38 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2014, 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 ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
    
    mysql> use inline
    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
    mysql> select * from test;
    +------+------+--------------+
    | id   | age  | name         |
    +------+------+--------------+
    |    0 | NULL | inlineuser   |
    |    1 | NULL | inlineunuser |
    |    2 | NULL | 中文         |
    +------+------+--------------+
    3 rows in set (0.00 sec)
    
    mysql> desc test
        -> ;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type        | Null | Key | Default | Extra |
    +-------+-------------+------+-----+---------+-------+
    | id    | int(11)     | YES  |     | NULL    |       |
    | age   | int(4)      | YES  |     | NULL    |       |
    | name  | varchar(16) | YES  |     | NULL    |       |
    +-------+-------------+------+-----+---------+-------+
    3 rows in set (0.00 sec)
  17. 将inline数据库改为utf8编码
    [[email protected] ~]#sed -i "s/gbk/utf8/g" /tmp/backup.sql
    [[email protected] ~]#vim /tmp/backup.sql
    
    [[email protected] ~]#mysql < /tmp/backup.sql
    [[email protected] ~]#mysql inline
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 12
    Server version: 5.5.38 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2014, 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 ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
    
    mysql> select * from test;
    +------+------+--------------+
    | id   | age  | name         |
    +------+------+--------------+
    |    0 | NULL | inlineuser   |
    |    1 | NULL | inlineunuser |
    |    2 | NULL | 中文         |
    +------+------+--------------+
    3 rows in set (0.00 sec)
    
    mysql>
  18. 忘记mysql root用户密码
    [[email protected] ~]#/usr/bin/mysqld_safe --skip-grant-tables &
    mysql> select host,user,password from mysql.user where user=‘root‘;
    +-----------------------+------+-------------------------------------------+
    | host                  | user | password                                  |
    +-----------------------+------+-------------------------------------------+
    | localhost             | root | *509910ED20429303306B7D5FA9215C7EC9E54B68 |
    | localhost.localdomain | root |                                           |
    | 127.0.0.1             | root |                                           |
    +-----------------------+------+-------------------------------------------+
    3 rows in set (0.00 sec)
    
    mysql> update mysql.user set password=password(123456) where user=‘root‘ and host=‘localhost‘;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> exit
    Bye
    [[email protected] ~]#/etc/init.d/mysqld stop
    150920 09:37:22 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
    Stopping mysqld:                                           [  OK  ]
    [1]+  Done                    /usr/bin/mysqld_safe --skip-grant-tables
    [[email protected] ~]#/etc/init.d/mysqld start
    Starting mysqld:                                           [  OK  ]
    [[email protected] ~]#mysql -uroot -p123456
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.5.38 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2014, 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 ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
    
    mysql>
  19. 在把id列设置为主键,在Name字段上创建普通索引
    mysql> alter table test add primary key idx_p(id);
    Query OK, 3 rows affected (0.02 sec)
    Records: 3  Duplicates: 0  Warnings: 0
    
    mysql> desc test
        -> ;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type        | Null | Key | Default | Extra |
    +-------+-------------+------+-----+---------+-------+
    | id    | int(11)     | NO   | PRI | 0       |       |
    | age   | int(4)      | YES  |     | NULL    |       |
    | name  | varchar(16) | YES  |     | NULL    |       |
    +-------+-------------+------+-----+---------+-------+
    3 rows in set (0.00 sec)
    
    mysql> alter table test add index idx_name(name);
    Query OK, 0 rows affected (0.02 sec)
    Records: 0  Duplicates: 0  Warnings: 0
  20. 在字段name后插入手机号码字段(moble),类型char(11)
    mysql> alter table test add mobile char(11);
    Query OK, 3 rows affected (0.02 sec)
    Records: 3  Duplicates: 0  Warnings: 0
    
    mysql> desc test
        -> ;
    +--------+-------------+------+-----+---------+-------+
    | Field  | Type        | Null | Key | Default | Extra |
    +--------+-------------+------+-----+---------+-------+
    | id     | int(11)     | NO   | PRI | 0       |       |
    | age    | int(4)      | YES  |     | NULL    |       |
    | name   | varchar(16) | YES  | MUL | NULL    |       |
    | mobile | char(11)    | YES  |     | NULL    |       |
    +--------+-------------+------+-----+---------+-------+
    4 rows in set (0.00 sec)
    
    mysql> select * from test;
    +----+------+--------------+--------+
    | id | age  | name         | mobile |
    +----+------+--------------+--------+
    |  0 | NULL | inlineuser   | NULL   |
    |  1 | NULL | inlineunuser | NULL   |
    |  2 | NULL | 中文         | NULL   |
    +----+------+--------------+--------+
    3 rows in set (0.00 sec)
    
    mysql> insert into test values(3,5,‘foson‘,‘13455556666‘),(4,5,‘foson‘,‘13577889966‘);
    Query OK, 2 rows affected (0.01 sec)
    Records: 2  Duplicates: 0  Warnings: 0
    
    mysql> select * from test;
    +----+------+--------------+-------------+
    | id | age  | name         | mobile      |
    +----+------+--------------+-------------+
    |  0 | NULL | inlineuser   | NULL        |
    |  1 | NULL | inlineuser | NULL        |
    |  2 | NULL | 中文         | NULL        |
    |  3 |    5 | foson     | 13455556666 |
    |  4 |    5 | foson      | 13577889966 |
    +----+------+--------------+-------------+
    5 rows in set (0.00 sec)
  21. 在手机字段上对前8个字符创建普通索引
    mysql> alter table test add index idx_m (mobile(8));
    Query OK, 0 rows affected (0.02 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    mysql> show index from test;
    +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
    +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    | test  |          0 | PRIMARY  |            1 | id          | A         |           5 |     NULL | NULL   |      | BTREE      |         |               |
    | test  |          1 | idx_name |            1 | name        | A         |           5 |     NULL | NULL   | YES  | BTREE      |         |               |
    | test  |          1 | idx_m    |            1 | mobile      | A         |           5 |        8 | NULL   | YES  | BTREE      |         |               |
    +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    3 rows in set (0.00 sec)
    
    mysql> show index from test\G;
    *************************** 1. row ***************************
            Table: test
       Non_unique: 0
         Key_name: PRIMARY
     Seq_in_index: 1
      Column_name: id
        Collation: A
      Cardinality: 5
         Sub_part: NULL
           Packed: NULL
             Null:
       Index_type: BTREE
          Comment:
    Index_comment:
    *************************** 2. row ***************************
            Table: test
       Non_unique: 1
         Key_name: idx_name
     Seq_in_index: 1
      Column_name: name
        Collation: A
      Cardinality: 5
         Sub_part: NULL
           Packed: NULL
             Null: YES
       Index_type: BTREE
          Comment:
    Index_comment:
    *************************** 3. row ***************************
            Table: test
       Non_unique: 1
         Key_name: idx_m
     Seq_in_index: 1
      Column_name: mobile
        Collation: A
      Cardinality: 5
         Sub_part: 8
           Packed: NULL
             Null: YES
       Index_type: BTREE
          Comment:
    Index_comment:
    3 rows in set (0.00 sec)
    
    ERROR:
    No query specified
  22. 删除name mobile列的索引
    mysql> alter table test drop index idx_name;
    Query OK, 0 rows affected (0.00 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> alter table test drop index idx_m;
    Query OK, 0 rows affected (0.00 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> show index from test\G;
    *************************** 1. row ***************************
            Table: test
       Non_unique: 0
         Key_name: PRIMARY
     Seq_in_index: 1
      Column_name: id
        Collation: A
      Cardinality: 5
         Sub_part: NULL
           Packed: NULL
             Null:
       Index_type: BTREE
          Comment:
    Index_comment:
    1 row in set (0.00 sec)
    
    ERROR:
    No query specified
  23. 对name列的钱6个字符以及手机列的钱8个字符组建联合索引
    mysql> alter table test add index idx_n_m (name(6),mobile(8));
    Query OK, 0 rows affected (0.01 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> show index from test\G;
    *************************** 1. row ***************************
            Table: test
       Non_unique: 0
         Key_name: PRIMARY
     Seq_in_index: 1
      Column_name: id
        Collation: A
      Cardinality: 5
         Sub_part: NULL
           Packed: NULL
             Null:
       Index_type: BTREE
          Comment:
    Index_comment:
    *************************** 2. row ***************************
            Table: test
       Non_unique: 1
         Key_name: idx_n_m
     Seq_in_index: 1
      Column_name: name
        Collation: A
      Cardinality: 5
         Sub_part: 6
           Packed: NULL
             Null: YES
       Index_type: BTREE
          Comment:
    Index_comment:
    *************************** 3. row ***************************
            Table: test
       Non_unique: 1
         Key_name: idx_n_m
     Seq_in_index: 2
      Column_name: mobile
        Collation: A
      Cardinality: 5
         Sub_part: 8
           Packed: NULL
             Null: YES
       Index_type: BTREE
          Comment:
    Index_comment:
    3 rows in set (0.00 sec)
    
    ERROR:
    No query specified
  24. 有索引及没有索引执行计划的不同
    mysql> select * from test where name=‘foson‘ and mobile like ‘135%‘;
    +----+------+---------+-------------+
    | id | age  | name    | mobile      |
    +----+------+---------+-------------+
    |  4 |    5 | foson | 13577889966 |
    +----+------+---------+-------------+
    1 row in set (0.00 sec)
    
    mysql> explain select * from test where name=‘foson‘ and mobile like ‘135%‘;
    +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
    | id | select_type | table | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
    +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
    |  1 | SIMPLE      | test  | range | idx_n_m       | idx_n_m | 46      | NULL |    1 | Using where |
    +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
    1 row in set (0.01 sec)
    
    mysql> alter table test drop index idx_n_m;
    Query OK, 0 rows affected (0.01 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> explain select * from test where name=‘foson‘ and mobile like ‘135%‘;
    +----+-------------+-------+------+---------------+------+---------+------+------+-------------+
    | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |
    +----+-------------+-------+------+---------------+------+---------+------+------+-------------+
    |  1 | SIMPLE      | test  | ALL  | NULL          | NULL | NULL    | NULL |    5 | Using where |
    +----+-------------+-------+------+---------------+------+---------+------+------+-------------+
    1 row in set (0.00 sec)
    
    mysql> 
    
    mysql> alter table test add index idx_n_m (name(6),mobile(8));
    Query OK, 0 rows affected (0.01 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> explain select * from test where  mobile like ‘135%‘;
    +----+-------------+-------+------+---------------+------+---------+------+------+-------------+
    | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |
    +----+-------------+-------+------+---------------+------+---------+------+------+-------------+
    |  1 | SIMPLE      | test  | ALL  | NULL          | NULL | NULL    | NULL |    5 | Using where |
    +----+-------------+-------+------+---------------+------+---------+------+------+-------------+
    1 row in set (0.00 sec)
    
    mysql> explain select * from test where name=‘foson‘ and mobile like ‘135%‘;
    +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
    | id | select_type | table | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
    +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
    |  1 | SIMPLE      | test  | range | idx_n_m       | idx_n_m | 46      | NULL |    1 | Using where |
    +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
    1 row in set (0.00 sec)
    
    mysql> explain select * from test where name=‘foson‘;
    +----+-------------+-------+------+---------------+---------+---------+-------+------+-------------+
    | id | select_type | table | type | possible_keys | key     | key_len | ref   | rows | Extra       |
    +----+-------------+-------+------+---------------+---------+---------+-------+------+-------------+
    |  1 | SIMPLE      | test  | ref  | idx_n_m       | idx_n_m | 21      | const |    2 | Using where |
    +----+-------------+-------+------+---------------+---------+---------+-------+------+-------------+
    1 row in set (0.00 sec)
    
    mysql>
时间: 2024-10-28 14:28:35

老男孩mysql练习题自我学习的相关文章

Python/ MySQL练习题(一)

Python/ MySQL练习题(一) 2.查询"生物"课程比"物理"课程成绩高的所有学生的学号 1 SELECT 2 * 3 FROM 4 ( 5 SELECT 6 * 7 FROM 8 course 9 LEFT JOIN score ON score.course_id = course.cid 10 WHERE 11 course.cname = '生物' 12 ) AS A 13 INNER JOIN ( 14 SELECT 15 * 16 FROM 17

UFLDL深度学习教程翻译之自我学习

一.概述 假设我们有足够强大的学习算法,得到较好结果的其中一种最靠谱的方法是给算法提供更多的数据.这验证了在机器学习的那句格言:"有时候获胜的不是谁有最好的算法,而是谁有最多的数据." 也许有人总能得到有标记的数据,但这么做成本很高.特别地,研究人员已经采用极致的工具例如AMT(亚马逊土耳其机器人)来得到大量训练集.尽管拥有大量的人们人工标记的数据相比拥有大量的研究人员的工程性质的特征已经迈进了一步,但还能做的更好.特别地,自我学习以及无监督特征学习的方法是说,如果我们让我们的算法从无

计算机可以这样玩—自我学习,自我思维,自我工作(编程)

如果让计算机产生自我意识,那一定件很好玩的事情. 我在想,怎么让计算机产生自我意识和自我学习的思维能力呢,特别是在工业集群中的应用. 由这个问题,我们先问问人类是怎么自我产生意识的. 人类的自我意识主要是客观或主观环境刺激或引导而产生了自我神经思维能力的,对吧. 那么这样就很好理解了,机器同样可以产生自我意识和自我学习的过程. 现在我们来造这个机器,   首先是cpu的问题,如果以目前的二进制cpu来做,肯定是做不做的:因此我们首先否定现有的cpu所有的工艺方式.               那

mysql 存储过程简单学习

转载自:http://blog.chinaunix.net/uid-23302288-id-3785111.html ■存储过程Stored Procedure 存储过程就是保存一系列SQL命令的集合,将这些sql命令有组织的形成一个小程序,这样会实现很复杂的处理 SQL基本是一个命令一个命令执行,虽然可以通过连接.子查询等实现些高级的处理,但局限性是显而易见的 ■存储过程的优势 1.提高执行性能(存储过程事先完成了解析.编译的处理,执行时能减轻数据库负担) 2.可减轻网络负担(比起多次传递SQ

智能机器人的高级阶段:不受人工控制的自我学习

文/辛东方,80后作家.专栏作者.专注互联网科技领域 "人工智能""一词的提出发展到现在,已经走过六十多个春秋.期间,各国的人工智能技术都在缓慢的进行着,发展虽然缓慢,但毕竟都是一直前进的. 按照一般的看法,人工智能是对人的意识.思维的信息过程的模拟.人工智能不是人的智能,但能像人那样思考.也可能超过人的智能.但初级阶段的人工智能是按照人的工程程序设置,到如果人工智能发展到高级阶段,有些模式可能会发生改变. 机器人技术是人工智能的体现,1920年,"机器人"

UFLDL教程笔记及练习答案三(Softmax回归与自我学习)

1:softmax回归 当p(y|x,theta)满足多项式分布,通过GLM对其进行建模就能得到htheta(x)关于theta的函数,将其称为softmax回归.教程中已经给了cost及gradient的求法.需要注意的是一般用最优化方法求解参数theta的时候,采用的是贝叶斯学派的思想,需要加上参数theta. 习题答案: (1) 数据加载------代码已给 (2) %% STEP 2: Implement softmaxCost   得到计算cost和gradient M = theta

linux下mysql数据库的学习

转载博客:http://freedomljtt.blog.163.com/blog/static/72294949201210145441701/ ubuntu12.04 卸载和安装mysql 卸载mysql 第一步 1 sudo apt-get autoremove --purge mysql-server-5.0 2 sudo apt-get remove mysql-server 3 sudo apt-get autoremove mysql-server 4 sudo apt-get r

mysql常用命令学习

1.\c取消当前准备执行的sql语句. mysql> select user,host,password from mysql.user;\c +--------+-----------+----------+ | user   | host      | password | +--------+-----------+----------+ | root   | localhost |          | | root   | mytest2   |          | | root  

MySQL Innodb 架构学习

一.MySQL后台线程   1.Master Thread 核心后台线程,主要负责将缓冲池的数据异步刷新到磁盘.例如脏页的刷新,插入缓冲的合并,undo 页的回收等. 1)每秒一次的操作: 日志缓冲刷新到磁盘,即使该事务还没有提交.该操作总是会发生,这个就是为了再大的事务,提交时间都很短. 当IO压力很小时(1s内发生的IO次数小于5% innodb_io_capacity)合并5% innodb_io_capacity 的插入缓冲. 当脏页比例大于 innodb_max_dirty_pages