MySQL5.5.21學習教程之一,mysql5.5.21教程

來源:互聯網
上載者:User

MySQL5.5.21學習教程之一,mysql5.5.21教程

     最近做項目需要MySQL,順便撿起好久沒弄的資料庫了!可能要寫一個系列關於MYSQL的學習筆記,那不來與大家共用!

     說到安裝資料庫,可真的夠讓人著急的!自己的系統是Windows8,安裝了一圈server卻沒有找到最好的,功夫不負有心人。找到了mysql-5.5.21-winx64.msi。終於成功了!

      具體的安裝細節請參考部落格:學習資料庫在win8上安裝!!

 

show databases;show engines;show engines \Gshow variables like 'have%';+----------------------+----------+| Variable_name        | Value    |+----------------------+----------+| have_compress        | YES      || have_crypt           | NO       || have_csv             | YES      || have_dynamic_loading | YES      || have_geometry        | YES      || have_innodb          | YES      || have_ndbcluster      | NO       || have_openssl         | DISABLED || have_partitioning    | YES      || have_profiling       | YES      || have_query_cache     | YES      || have_rtree_keys      | YES      || have_ssl             | DISABLED || have_symlink         | YES      |+----------------------+----------+show variables like 'storgae_engine%';[mysqld]# The TCP/IP Port the MySQL Server will listen onport=3306#Path to installation directory. All paths are usually resolved relative to this.basedir="C:/Program Files/MySQL/MySQL Server 5.5/"#Path to the database rootdatadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"# The default character set that will be used when a new schema or table is# created and no character set is definedcharacter-set-server=utf8# The default storage engine that will be used when create new tables whendefault-storage-engine=INNODBhelp contents;help Data Types;e.g.help TIME;Name: 'TIME'Description:TIMEA time. The range is '-838:59:59' to '838:59:59'. MySQL displays TIMEvalues in 'HH:MM:SS' format, but permits assignment of values to TIMEcolumns using either strings or numbers.URL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.htmluse test;create TABLE f_test(a FLOAT(38,30),b DECIMAL(38,30));INSERT INTO f_test VALUES (12443.43534534543,343243.2343546534636401);select * from f_test \G*************************** 1. row ***************************a: 12443.435546875000000000000000000000b: 343243.2343546534636401000000000000001 row in set (0.00 sec)create TABLE int_test(num INTEGER);INSERT INTo int_test VALUES (0),(-1),(-1.1),(1.1),(1009888);select * from int_test \G*************************** 1. row ***************************num: 0*************************** 2. row ***************************num: -1*************************** 3. row ***************************num: -1*************************** 4. row ***************************num: 1*************************** 5. row ***************************num: 10098885 rows in set (0.00 sec)create TABLE bit_test(id BIT(8));#添加的第一個數字為十進位的數字,第二個數字為二進位的資料insert into bit_test values (11),(b'11');select id+0 from bit_test \G*************************** 1. row ***************************id+0: 11*************************** 2. row ***************************id+0: 32 rows in set (0.00 sec)select BIN(id+0) from bit_test \G*************************** 1. row ***************************BIN(id+0): 1011*************************** 2. row ***************************BIN(id+0): 112 rows in set (0.28 sec)#時間日期的插入學習create table date_test(f_date DATE,f_datetime DATETIME,f_timestamp TIMESTAMP,f_time TIME,f_year YEAR);select CURDATE();+------------+| CURDATE()  |+------------+| 2015-01-14 |+------------+select CURDATE(),NOW(),NOW(),time(NOW()),year(NOW()) \G*************************** 1. row ***************************  CURDATE(): 2015-01-14      NOW(): 2015-01-14 19:39:56      NOW(): 2015-01-14 19:39:56time(NOW()): 19:39:56year(NOW()): 20151 row in set (0.00 sec)insert into date_test values (CURDATE(),NOW(),NOW(),time(NOW()),year(NOW()));select * from date_test \G*************************** 1. row ***************************     f_date: 2015-01-14 f_datetime: 2015-01-14 19:41:07f_timestamp: 2015-01-14 19:41:07     f_time: 19:41:07     f_year: 20151 row in set (0.00 sec)create TABLE user(id INTEGER,name VARCHAR(20));insert into user values (1,'bob'),(2,'petter');select * from user;+------+--------+| id   | name   |+------+--------+|    1 | bob    ||    2 | petter |+------+--------+show tables;+----------------+| Tables_in_test |+----------------+| bit_test       || date_test      || f_test         || int_table      || int_test       || user           |+----------------+

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.