MySQL 5.6.21下载安装之安装篇(二)

 

mysql安装

 

1.1 Linux之下MySQL安装的三种方案的比较

具体内容参考这篇bloghttp://blog.itpub.net/8183550/viewspace-680749/

 

一.1  windows 下安装(mysql-5.6.21-win32)

一.1.1  mysql server 安装

 

1登录   http://dev.mysql.com/downloads/

 

2进入如下页面:(该图为页面最底部)

 

 

 

3下载完成解压该文件mysql-5.6.21-win32.zip

 

4打开文件mysql-5.6.21-win32

5用记事本打开my-default.ini

 

 

修改

basedir=C:\Program Files\MySQL\MySQL Server 5.6(mysql所在目录)

datadir=C:\Program Files\MySQL\MySQL Server 5.6\data (mysql所在目录\data)

 

 

完成上述步骤之后,很多用户开始使用MySQL,但会出现图示的错误。这是因为没有配置环境变量所致。

配置环境变量很简单:

我的电脑->属性->高级->环境变量

选择PATH,在其后面添加: 你的mysql bin文件夹的路径 (如:C:\Program Files\MySQL\MySQL Server 5.6\bin )

PATH=.......;C:\Program Files\MySQL\MySQL Server 5.6\bin (注意是追加,不是覆盖)

 

以管理员身份运行cmd(一定要用管理员身份运行,不然权限不够),

输入:cd C:\Program Files\MySQL\MySQL Server 5.6\bin 进入mysql的bin文件夹(不管有没有配置过环境变量,也要进入bin文件夹,否则之后启动服务仍然会报错误2)

输入mysqld -install  (如果不用管理员身份运行,将会因为权限不够而出现错误:Install/Remove of the Service Denied!)

安装成功

 

 

安装成功后就要启动服务了,继续在cmd中输入:net start mysql(如图),服务启动成功!

 

mysqld -install  执行成功后就在系统的服务里添加了如下服务:

 

 

在cmd输入命令mysqladmin -uroot -p password (新密码)

Enter password:(初始密码没有,所以直接回车)

密码设置成功。

 

 

 

一.1.1  mysql-workbench-community-6.2.3-win32-noinstall

登录http://dev.mysql.com/downloads/ 

 

 

进入如下页面:

 

  解压mysql-workbench-community-6.2.3-win32-noinstall.zip

打开文件D:\Program files\MySQL\MySQL Workbench 6.2.4 CE (winx64)

 

 

 

 

填写相应的条件就可以连接数据库了

 

 

安装成功的2个条件:

 

注 :安装MySQL workbench需安装

1.microsoft visual c++ 2013

2.

 

 

MySQL Workbench Prerequisites:

To be able to install and run MySQL Workbench your System needs to have libraries listed below installed. The listed items are provided as links to the corresponding download pages where you can fetch the necessary files.

· Microsoft .NET Framework 4 Client Profile

· Visual C++ Redistributable for Visual Studio 2013

 

一.1  linux下安装--rpm安装

下载安装包后将安装包利用ftp软件上传到server端,如图:

 

 

MD5值校验:

[root@rhel6_lhr Downloads]# md5sum MySQL\ Database\ 5.6.21\ RPM\ for\ Oracle\ Linux\ \ RHEL\ 6\ x86\ \(64bit\).zip

c4dc6be57e494825fac08a219399190d  MySQL Database 5.6.21 RPM for Oracle Linux  RHEL 6 x86 (64bit).zip

[root@rhel6_lhr Downloads]#

 

 

解压缩之后:

 

unzip MySQL Database 5.6.21 RPM for Oracle Linux  RHEL 6 x86 (64bit).zip

 

 

[root@rhel6_lhr Downloads]# ll

total 227184

-rw-r--r--. 1 root root 232632160 Nov 26 20:32 MySQL Database 5.6.21 RPM for Oracle Linux  RHEL 6 x86 (64bit).zip

[root@rhel6_lhr Downloads]# unzip MySQL\ Database\ 5.6.21\ RPM\ for\ Oracle\ Linux\ \ RHEL\ 6\ x86\ \(64bit\).zip

Archive:  MySQL Database 5.6.21 RPM for Oracle Linux  RHEL 6 x86 (64bit).zip

extracting: MySQL-client-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: MySQL-server-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: MySQL-devel-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: MySQL-shared-compat-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: MySQL-embedded-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: MySQL-shared-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: MySQL-test-advanced-5.6.21-1.el6.x86_64.rpm 

extracting: README.txt             

[root@rhel6_lhr Downloads]# ll

total 454376

-rwxr-xr-x. 1 root root  18706988 Sep 12 10:25 MySQL-client-advanced-5.6.21-1.el6.x86_64.rpm

-rw-r--r--. 1 root root 232632160 Nov 26 20:32 MySQL Database 5.6.21 RPM for Oracle Linux  RHEL 6 x86 (64bit).zip

-rwxr-xr-x. 1 root root   3292908 Sep 12 10:25 MySQL-devel-advanced-5.6.21-1.el6.x86_64.rpm

-rwxr-xr-x. 1 root root  88742236 Sep 12 10:26 MySQL-embedded-advanced-5.6.21-1.el6.x86_64.rpm

-rwxr-xr-x. 1 root root  65023820 Sep 12 10:27 MySQL-server-advanced-5.6.21-1.el6.x86_64.rpm

-rwxr-xr-x. 1 root root   2021044 Sep 12 10:27 MySQL-shared-advanced-5.6.21-1.el6.x86_64.rpm

-rwxr-xr-x. 1 root root   3945172 Sep 23 16:01 MySQL-shared-compat-advanced-5.6.21-1.el6.x86_64.rpm

-rwxr-xr-x. 1 root root  50883224 Sep 12 10:28 MySQL-test-advanced-5.6.21-1.el6.x86_64.rpm

-rwxr-xr-x. 1 root root     15476 Sep 23 07:10 README.txt

[root@rhel6_lhr Downloads]#

 

基本情况下安装client和server就可以了。

[root@rhel6_lhr Downloads]# rpm -ivh MySQL-client-advanced-5.6.21-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-client-advanced  ########################################### [100%]

[root@rhel6_lhr Downloads]#

 

采用yum安装:

[root@rhel6_lhr Downloads]# yum install MySQL-server-advanced-5.6.21-1.el6.x86_64.rpm

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Setting up Install Process

Examining MySQL-server-advanced-5.6.21-1.el6.x86_64.rpm: MySQL-server-advanced-5.6.21-1.el6.x86_64

Marking MySQL-server-advanced-5.6.21-1.el6.x86_64.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package MySQL-server-advanced.x86_64 0:5.6.21-1.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

===============================================================================================================================================================================================================================================================================

Package                                                           Arch                                               Version                                                     Repository                                                                              Size

===============================================================================================================================================================================================================================================================================

Installing:

MySQL-server-advanced                                             x86_64                                             5.6.21-1.el6                                                /MySQL-server-advanced-5.6.21-1.el6.x86_64                                             255 M

 

Transaction Summary

===============================================================================================================================================================================================================================================================================

Install       1 Package(s)

 

Total size: 255 M

Installed size: 255 M

Is this ok [y/N]: y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : MySQL-server-advanced-5.6.21-1.el6.x86_64                                                                                                                                                                                                                   1/1

warning: user mysql does not exist - using root

warning: group mysql does not exist - using root

2014-11-27 09:56:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2014-11-27 09:56:47 356 [Note] InnoDB: Using atomics to ref count buffer pool pages

2014-11-27 09:56:47 356 [Note] InnoDB: The InnoDB memory heap is disabled

2014-11-27 09:56:47 356 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2014-11-27 09:56:47 356 [Note] InnoDB: Memory barrier is not used

2014-11-27 09:56:47 356 [Note] InnoDB: Compressed tables use zlib 1.2.3

2014-11-27 09:56:47 356 [Note] InnoDB: Using Linux native AIO

2014-11-27 09:56:47 356 [Note] InnoDB: Using CPU crc32 instructions

2014-11-27 09:56:47 356 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2014-11-27 09:56:47 356 [Note] InnoDB: Completed initialization of buffer pool

2014-11-27 09:56:47 356 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2014-11-27 09:56:47 356 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2014-11-27 09:56:47 356 [Note] InnoDB: Database physically writes the file full: wait...

2014-11-27 09:56:48 356 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2014-11-27 09:56:49 356 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2014-11-27 09:56:50 356 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2014-11-27 09:56:50 356 [Warning] InnoDB: New log files created, LSN=45781

2014-11-27 09:56:50 356 [Note] InnoDB: Doublewrite buffer not found: creating new

2014-11-27 09:56:50 356 [Note] InnoDB: Doublewrite buffer created

2014-11-27 09:56:50 356 [Note] InnoDB: 128 rollback segment(s) are active.

2014-11-27 09:56:50 356 [Warning] InnoDB: Creating foreign key constraint system tables.

2014-11-27 09:56:50 356 [Note] InnoDB: Foreign key constraint system tables created

2014-11-27 09:56:50 356 [Note] InnoDB: Creating tablespace and datafile system tables.

2014-11-27 09:56:50 356 [Note] InnoDB: Tablespace and datafile system tables created.

2014-11-27 09:56:50 356 [Note] InnoDB: Waiting for purge to start

2014-11-27 09:56:50 356 [Note] InnoDB: 5.6.21 started; log sequence number 0

2014-11-27 09:56:50 356 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.

2014-11-27 09:56:50 356 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.

2014-11-27 09:56:51 356 [Note] Binlog end

2014-11-27 09:56:51 356 [Note] InnoDB: FTS optimize thread exiting.

2014-11-27 09:56:51 356 [Note] InnoDB: Starting shutdown...

2014-11-27 09:56:53 356 [Note] InnoDB: Shutdown completed; log sequence number 1625977

A random root password has been set. You will find it in '/root/.mysql_secret'.

 

 

2014-11-27 09:56:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2014-11-27 09:56:53 382 [Note] InnoDB: Using atomics to ref count buffer pool pages

2014-11-27 09:56:53 382 [Note] InnoDB: The InnoDB memory heap is disabled

2014-11-27 09:56:53 382 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2014-11-27 09:56:53 382 [Note] InnoDB: Memory barrier is not used

2014-11-27 09:56:53 382 [Note] InnoDB: Compressed tables use zlib 1.2.3

2014-11-27 09:56:53 382 [Note] InnoDB: Using Linux native AIO

2014-11-27 09:56:53 382 [Note] InnoDB: Using CPU crc32 instructions

2014-11-27 09:56:53 382 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2014-11-27 09:56:53 382 [Note] InnoDB: Completed initialization of buffer pool

2014-11-27 09:56:53 382 [Note] InnoDB: Highest supported file format is Barracuda.

2014-11-27 09:56:53 382 [Note] InnoDB: 128 rollback segment(s) are active.

2014-11-27 09:56:53 382 [Note] InnoDB: Waiting for purge to start

2014-11-27 09:56:53 382 [Note] InnoDB: 5.6.21 started; log sequence number 1625977

2014-11-27 09:56:53 382 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.

2014-11-27 09:56:53 382 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.

2014-11-27 09:56:53 382 [Note] Binlog end

2014-11-27 09:56:53 382 [Note] InnoDB: FTS optimize thread exiting.

2014-11-27 09:56:53 382 [Note] InnoDB: Starting shutdown...

2014-11-27 09:56:55 382 [Note] InnoDB: Shutdown completed; log sequence number 1625987

 

 

 

 

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

 

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

 

Also, the account for the anonymous user has been removed.

 

In addition, you can run:

 

  /usr/bin/mysql_secure_installation

 

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

 

See the manual for more instructions.

 

Please report any problems at http://bugs.mysql.com/

 

The latest information about MySQL is available on the web at

 

  http://www.mysql.com

 

Support MySQL by buying support/licenses at http://shop.mysql.com

 

New default config file was created as /usr/my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

 

  Verifying  : MySQL-server-advanced-5.6.21-1.el6.x86_64                                                                                                                                                                                                                   1/1

 

Installed:

  MySQL-server-advanced.x86_64 0:5.6.21-1.el6                                                                                                                                                                                                                                 

 

Complete!

[root@rhel6_lhr Downloads]#

以上红色字体大概是说一个随机密码已经设置了,'/root/.mysql_secret'可以看到,/usr/my.cnf 是默认的配置文件,还有其他的一些等等。。。

 

 

查看随机密码:

[root@rhel6_lhr ~]# more /root/.mysql_secret

# The random password set for the root user at Thu Nov 27 09:56:51 2014 (local time): nIchCMdDyQU43HnK

 

[root@rhel6_lhr ~]#

 

 

一.1.1  启动服务

/etc/init.d/mysql start  或  service mysql start

 

[root@rhel6_lhr ~]# service mysql start

Starting MySQL... SUCCESS!

[root@rhel6_lhr ~]#

 

修改密码,执行/root/mysql_secure_installation:

 

[root@rhel6_lhr ~]# pwd

/root

[root@rhel6_lhr ~]# mysql_secure_installation

 

 

 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

 

In order to log into MySQL to secure it, we'll need the current

password for the root user.  If you've just installed MySQL, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

 

Enter current password for root (enter for none):

OK, successfully used password, moving on...

 

Setting the root password ensures that nobody can log into the MySQL

root user without the proper authorisation.

 

You already have a root password set, so you can safely answer 'n'.

 

Change the root password? [Y/n] y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

 

 

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

 

Remove anonymous users? [Y/n] y

... Success!

 

Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.

 

Disallow root login remotely? [Y/n] n

... skipping.

 

By default, MySQL comes with a database named 'test' that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.

 

Remove test database and access to it? [Y/n] y^Hn

... skipping.

 

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

 

Reload privilege tables now? [Y/n] y

... Success!

 

 

 

 

All done!  If you've completed all of the above steps, your MySQL

installation should now be secure.

 

Thanks for using MySQL!

 

 

Cleaning up...

[root@rhel6_lhr ~]#

 

一.1.2  连接mysql

 

 

 

 

 

一.1.3  登录

帮助: mysqladmin --help | less

 

 

1. mysql -h192.168.59.130 -uroot -P3300 -p

2. mysql -p

3. mysql -uroot -p

4. mysql -u root -p

5. mysql -S ./mysql.sock --protocol=socket -p

6. mysql -h localhost --protocol=tcp -p

7. mysql -uroot -h localhost -P 3306 -p

8. mysql -uroot -h 192.168.59.130 -P 3306 -p

9. mysql -uroot -h192.168.59.130 -p 

 

[root@rhel6_lhr ~]# mysql -plhr

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

 

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> exit

Bye

[root@rhel6_lhr ~]# mysql -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

 

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>

一.1.4  一些简单的sql语句

 

一.1.4.1  建数据库

1. create database  dbname;

2. drop database dbname;

3. show databases;

 

[root@rhel6_lhr ~]# mysql -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 15

Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

 

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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| lhr_test           |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

 

mysql> drop database lhr_test;

Query OK, 0 rows affected (0.26 sec)

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> create database lhr_test;

Query OK, 1 row affected (0.00 sec)

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| lhr_test           |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

 

mysql>

 

 

 

一.1.4.2  创建和删除表

1. create table t1(id int(10),name varchar(20));

2. drop table t1;

3. show tables;

4. use dbname;

 

[root@rhel6_lhr ~]# mysql -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 17

Server version: 5.6.21-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

 

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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| lhr_test           |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

 

mysql> use lhr_test;

Database changed

mysql> create table t1(id int(10),name varchar(20));

Query OK, 0 rows affected (0.64 sec)

 

mysql> show tables;

+--------------------+

| Tables_in_lhr_test |

+--------------------+

| t1                 |

+--------------------+

1 row in set (0.00 sec)

 

mysql> create table t2(id int(10));

Query OK, 0 rows affected (0.08 sec)

 

mysql> show tables;

+--------------------+

| Tables_in_lhr_test |

+--------------------+

| t1                 |

| t2                 |

+--------------------+

2 rows in set (0.00 sec)

 

mysql> drop table t2;

Query OK, 0 rows affected (0.04 sec)

 

mysql> show tables;

+--------------------+

| Tables_in_lhr_test |

+--------------------+

| t1                 |

+--------------------+

1 row in set (0.00 sec)

 

mysql>

 

一.1.4.3  查看表结构

1. desc tablename; or  describe tablename;

2. show create table tablename;

 

mysql> desc t1;

+-------+-------------+------+-----+---------+-------+

| Field | Type        | Null | Key | Default | Extra |

+-------+-------------+------+-----+---------+-------+

| id    | int(10)     | YES  |     | NULL    |       |

| name  | varchar(20) | YES  |     | NULL    |       |

+-------+-------------+------+-----+---------+-------+

2 rows in set (0.08 sec)

 

mysql> show create table t1;

+-------+---------------------------------------------------------------------------------------------------------------------------+

| Table | Create Table                                                                                                              |

+-------+---------------------------------------------------------------------------------------------------------------------------+

| t1    | CREATE TABLE `t1` (

  `id` int(10) DEFAULT NULL,

  `name` varchar(20) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1 |

+-------+---------------------------------------------------------------------------------------------------------------------------+

1 row in set (0.03 sec)

 

mysql> show create table t1\G;

*************************** 1. row ***************************

       Table: t1

Create Table: CREATE TABLE `t1` (

  `id` int(10) DEFAULT NULL,

  `name` varchar(20) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1

1 row in set (0.00 sec)

 

ERROR:

No query specified

 

mysql>

 

一.1.4.4  插入数据

insert into tablename set id=1,name=’lihuarong’;

insert into tablename(id,name) values(2,’zhangsan’),(3,’lisi’);

 

mysql> insert into t1 set id=1,name='lihuarong';

Query OK, 1 row affected (0.06 sec)

 

mysql> insert into t1(id,name) values(2,'zhangsan'),(3,'lisi');

Query OK, 2 rows affected (0.00 sec)

Records: 2  Duplicates: 0  Warnings: 0

 

mysql>

 

一.1.4.5  查询

mysql> select * from t1;

+------+-----------+

| id   | name      |

+------+-----------+

|    1 | lihuarong |

|    2 | zhangsan  |

|    3 | lisi      |

+------+-----------+

3 rows in set (0.03 sec)

 

mysql>

一.1.5  获得帮助

 

mysql> ?

 

For information about MySQL products and services, visit:

   http://www.mysql.com/

For developer information, including the MySQL Reference Manual, visit:

   http://dev.mysql.com/

To buy MySQL Enterprise support, training, or other products, visit:

   https://shop.mysql.com/

 

List of all MySQL commands:

Note that all text commands must be first on line and end with ';'

?         (\?) Synonym for `help'.

clear     (\c) Clear the current input statement.

connect   (\r) Reconnect to the server. Optional arguments are db and host.

delimiter (\d) Set statement delimiter.

ego       (\G) Send command to mysql server, display result vertically.

exit      (\q) Exit mysql. Same as quit.

go        (\g) Send command to mysql server.

help      (\h) Display this help.

notee     (\t) Don't write into outfile.

print     (\p) Print current command.

prompt    (\R) Change your mysql prompt.

quit      (\q) Quit mysql.

rehash    (\#) Rebuild completion hash.

source    (\.) Execute an SQL script file. Takes a file name as an argument.

status    (\s) Get status information from the server.

tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.

use       (\u) Use another database. Takes database name as argument.

charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.

warnings  (\W) Show warnings after every statement.

nowarning (\w) Don't show warnings after every statement.

 

For server side help, type 'help contents'

 

mysql> select database();

+------------+

| database() |

+------------+

| mysql      |

+------------+

1 row in set (0.00 sec)

 

 

 

一.1.6  总结

 

 

mysql> show tables;

+--------------------+

| Tables_in_lhr_test |

+--------------------+

| t1                 |

+--------------------+

1 row in set (0.00 sec)

 

mysql> create table T1(id int(5));

Query OK, 0 rows affected (0.06 sec)

 

mysql> show tables;

+--------------------+

| Tables_in_lhr_test |

+--------------------+

| T1                 |

| t1                 |

+--------------------+

2 rows in set (0.00 sec)

 

mysql>

时间: 2024-09-26 06:46:49

MySQL 5.6.21下载安装之安装篇(二)的相关文章

MySQL 5.6.21下载安装之下载篇(一)

          隐隐约约感觉到学数据库多多少少以后会涉及到mysql,好吧,那就趁着现在工作不是很忙的时间抽空来学学mysql吧,把这几天视频中学习到的知识和笔记整理了一下发出来大家共同学习,同时也以此来记录我的mysql学习历程.   MySQL 5.6.21最新版下载     MySQL Enterprise Edition (commercial) 商业版 第一步:登录mysql的官方网站 http://www.mysql.com/downloads/   或者直接登录: https:

Centos 6.5 下安装mysql 5.6.21的方法_Mysql

创建需要下载rpm包软件包的目录: # mkdir -p /taokey/tools/ 查看系统是否自带了mysql包 若有删除 # rpm -qa|grep mysql mysql-libs-5.1.71-1.el6.x86_64 mysql-server-5.1.71-1el6.x86_64 # yum remove mysql-server mysql-libs #rpm -qa|grep mysql # 这就表示没有mysql的包了 若安装过mysql 过 删除了包还需一下操作 # fi

CentOS 6.5下安装MySQL 5.6.21

MySQL安装 Linux中使用最广泛的数据库就是MySQL,使用在线yum的方式安装的版本落后MySQL网站好几个小版本,本节亲自测试安装新版的MySQL. 测试机器环境: VMware Workstation 10 虚拟机 内存:1G Linux版本:CentOS MinimalCD 6.5 JAVA:JAVA_HOME=/opt/jdk 安装mysql前需要查询系统中含有的有关mysql的软件. rpm -qa | grep -i mysql  //grep -i是不分大小写字符查询,只要

mysql 5.7.14 下载安装、配置与使用详细教程_Mysql

 下载 a.我这里用的是 ZIP Archive版的,win8 64位的机器都支持 这个所以我建议都用这个.还有这个比较简单而且还很干净.地址见图.拖到最下面,看清楚了64bit ZIP Archive,点击Download. b.点开之后会进入另一个页面,但却没有下载,这个时候不用怕,看不懂也没关系,他的意思就是让你登录(login),或者注册个账号(sign up)就行了,登录或者注册成功后就开始下载了.(记住密码要字母和数字组合,并且要大小写混合) c.当然如果你有的话也可以直接登录. 成

MySQL的rpm和源码两种安装操作

相比于传统行业,互联网浪潮中MySQL一直是数据库的主力军,无论是曾经的SUN,还是现在的Oracle,虽然可能商业策略不同,但发展方向还是平稳向前的,因此说自己不会MySQL,还真有些不好意思了. 我只能算是MySQL中的小小白,研究生毕设的时候,装过windows版本的MySQL,就像对Oracle一样,仅仅是用,但对于一门技术来说,没有深入理解运行的原理,就不算真正了解这门技术.又有一种说法,就是相似的技术是相通的,原理性质的知识,有些是可以复用学习和了解. 碰巧有一个旁支的项目,要用My

MySQL 5.0在windows上的安装详细介绍

使用自动化安装程序自动安装MySQL 新的MySQL 5.0用户可以使用MySQL安装向导和MySQL配置向导在Windows上安装Mysql.设计这两个向导的目的就是为了方便新用户能够很快的使用MySQL.在MySQL完全安装包中,MySQL安装向导和MySQL配置向导都是可用的,同时这两个向导在大部分标准的MySQL安装程序中被推荐使用.不使用这两个向导的例外包括用户需要在一台服务器上安装多个MySQL实例和高级用户想要完全获得高级服务器的配置. 使用MySQL安装向导 介绍 MySQL安装

MySql 5.7.14 解压版安装步骤详解_Mysql

下面主要分为五大步给大家介绍mySql 5.7.14 解压版安装教程.感兴趣的朋友一起看看吧. 第一步:下载最近的MySQL文件并且解压: 下载最新版的MySQL–mysql-5.7.12下载地址 将下载到的文件解压缩到自己喜欢的位置,例如我自己的位置是D:\MySQL\mysql-5.7.12-winx64 第二步:配置环境变量 这里不多说,bin目录配置到path下面就行了. 第三步:添加配置文件 直接复制一个解压路径下面的 my-default.ini文件,重命名为my.ini然后编辑该文

MySql 5.6.14 Win32位免安装解压缩版配置教程_Mysql

mysql-5.6.14-win32为免安装解压缩版,安装版(http://dev.mysql.com/downloads/installer/5.5.html)存在很多弊端. mysql 5.6.14 win7 32位免安装版配置方法如下所示: 1.下载mysql 5.6.14:下载地址:http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14-win32.zip 2.解压到自定义目录,我的是D:\ProgramFiles\mysql5614w

mysql 5.6.17 绿色版(免安装)安装配置教程_Mysql

最近在做项目开发时用到了MySql数据库,在看了一些有关MySql的文章后,很快就上手使用了.在使用的过程中还是出现了一些问题,因为使用的是绿色免安装版的MySql所以在配置的时候出现了一些问题,该篇文章就主要针对MySql绿色版的配置及其使用进行讨论. 一.MySql概述       MySql数据库是有瑞典MySql AB公司开发,现在该公司被Oracle收购属于Oracle所有.同SQL Server类似,它也是基于关系型数据库的数据库管理系统,在Web应用方面MySQL是最好的RDBMS