- 浏览: 293693 次
- 性别:
- 来自: 济南
文章分类
- 全部博客 (197)
- 知识梳理 (37)
- 企业架构 (7)
- java (37)
- linux (20)
- oracle (7)
- mysql (15)
- ide使用 (18)
- spring (9)
- nginx (1)
- MyBatis (2)
- 计划 (2)
- javamail+james (1)
- activiti (1)
- 杂谈 (8)
- flex (17)
- android总结 (5)
- android小技巧 (6)
- 术语 (2)
- ant (3)
- window (10)
- svn (5)
- UML (2)
- DOS (2)
- log (5)
- netty (1)
- maven (3)
- zip (1)
- rar (1)
- hibernate (1)
- redis (1)
- JS (3)
- junit (1)
- git (3)
- resin (1)
- 设计模式 (1)
- 读书笔记 (1)
- 分布式 (1)
最新评论
-
aerfaguihua:
请问楼主 netty编写的客户端能否同步监听接收服务器传来的数 ...
Netty 简单样例分析 -
wanggang0321:
...
logback使用 -
lijunwyf41:
写的太好了
Rational Rose四个视图的含义、区别、用途 -
fengyie007:
如果已经修改了,直接更新了再提交就行了啊。
svn: is out of date -
liguangge285:
http://www.blogjava.net/wangfun ...
我的activiti学习笔记
转自:http://blog.csdn.net/tianlesoftware/article/details/7001808
一.下载说明
前期的一些准备说明,参考:
MySQL 发展史
http://blog.csdn.net/tianlesoftware/article/details/6999245
Mysql 不同版本 说明
http://blog.csdn.net/tianlesoftware/article/details/6723117
MySQL 分为Community Server 和 Enterprise Edition。 其中Community Server 可以直接从mysql 的官网下载。Enterprice Edition 只能从Oracle edelivery上下载,不过Edelivery 现在。
1.1 官方文档上有关MySQL安装文件类型说明:
http://dev.mysql.com/doc/refman/5.5/en/index.html
Linux supports anumber of different solutions for installing MySQL. The recommended method isto use one of the distributions from Oracle. If you choose this method, thereare three options available:
(1)Installingfrom a generic binary package in .tar.gz format. See Section 2.2,“Installing MySQL from Generic Binaries on Unix/Linux” for moreinformation.
(2)Extractingand compiling MySQL from a source distribution. For detailed instructions,see Section 2.9, “InstallingMySQL from Source”.
(3)Installingusing a pre-compiled RPM package. For more information on using the RPMsolution, see Section 2.5.1,“Installing MySQL from RPM Packages on Linux”.
--这里讲了3种方式来安装MySQL数据库,我这里用最简单的RPM 包来安装。
As analternative, you can use the native package manager within your Linuxdistribution to automatically download and install MySQL for you. Nativepackage installations can take of the download and dependencies required to runMySQL, but the MySQL version will often be some way behind the currentlyavailable release. You will also normally be unable to install developmentalreleases, as these are not usually made available in the native repository. Formore information on using the native package installers, see Section 2.5.2,“Installing MySQL on Linux using Native Package Manager”.
Note
For many Linux installations,you will want to set up MySQL to be started automatically when your machinestarts. Many of the native package installations perform this operation foryou, but for source, binary and RPM solutions you may need to set this upseparately. The required script, mysql.server,can be found in the support-filesdirectory under the MySQL installationdirectory or in a MySQL source tree. You can install itas/etc/init.d/mysql for automatic MySQL startup and shutdown. See Section 2.10.1.2,“Starting and Stopping MySQL Automatically”.
--这里要注意一个问题,就是设置MySQL的自启动。 如果使用native package来安装,会自动设置为自启动,如果使用其他的方式,如source,binary和RPM,就需要单独的来设置自启动。
1.2 下载安装包
我这里下载Community Server 版的,Enterprise Edition版的请到Oracle E-Delivery上下载。Enterprise Edition 有30天的试用期。
Community Server下载地址:http://www.mysql.com/downloads/mysql/
这里要注意的,MySQL的Tar 包还是比较大,要比RPM包大3倍左右。
MySQL 的RPM 包有如下几个:
看一下每个rpm 包具体的描述:
(1)MySQL-server-VERSION.glibc23.i386.rpm
The MySQLserver. You need this unless you only want to connect to a MySQL server runningon another machine.
(2)MySQL-client-VERSION.glibc23.i386.rpm
The standardMySQL client programs. You probably always want to install this package.
(3)MySQL-devel-VERSION.glibc23.i386.rpm
The librariesand include files that are needed if you want to compile other MySQL clients,such as the Perl modules.
(4)MySQL-debuginfo-VERSION.glibc23.i386.rpm
This packagecontains debugging information. debuginfo RPMs are never needed touse MySQL software; this is true both for the server and for client programs.However, they contain additional information that might be needed by a debuggerto analyze a crash.
(5)MySQL-shared-VERSION.glibc23.i386.rpm
This packagecontains the shared libraries (libmysqlclient.so*) that certain languages andapplications need to dynamically load and use MySQL. It containssingle-threaded and thread-safe libraries. Prior toMySQL 5.5.6, if you install this package, do not installthe MySQL-shared-compat package.
(6)MySQL-shared-compat-VERSION.glibc23.i386.rpm
This packageincludes the shared libraries for MySQL 3.23, 4.0, and so on. It containssingle-threaded and thread-safe libraries. Install this package if you have applicationsinstalled that are dynamically linked against older versions of MySQL but youwant to upgrade to the current version without breaking the librarydependencies. Before MySQL 5.5.6, MySQL-shared-compat also includesthe libraries for the current release, so if you install it, you should notalso install MySQL-shared. As of 5.5.6, MySQL-shared-compat doesnot include the current library version, so there is no conflict.
(7)MySQL-embedded-VERSION.glibc23.i386.rpm
The embeddedMySQL server library.
(8)MySQL-test-VERSION.glibc23.i386.rpm
This packageincludes the MySQL test suite.
(9)MySQL-VERSION.src.rpm
This containsthe source code for all of the previous packages. It can also be used torebuild the RPMs on other architectures (for example, Alpha or SPARC).
二. 安装MySQL
2.1 安装说明
(1)MySQL的安装包有很多个,作用也不同,在大多数情况下,只需要安装MySQL-server 和 MySQL-client,其他的包根据需要来安装。
(2)The server RPM places data underthe /var/lib/mysql directory. The RPM also creates a login accountfor a user named mysql (if one does not exist) to use for running theMySQL server, and creates the appropriate entries in /etc/init.d/ tostart the server automatically at boot time. (This means that if you haveperformed a previous installation and have made changes to its startup script,you may want to make a copy of the script so that you do not lose it when youinstall a newer RPM.)
(3)During RPM installation, a usernamed mysql and a group named mysql are created on thesystem. This is done using the useradd, groupadd,and usermod commands. Those commands require appropriateadministrative privileges, which is required for locally managed users andgroups (as listed in the /etc/passwd and /etc/groupfiles) by theRPM installation process being run by root.
--在MySQL 安装时,会创建mysql 用户和mysql组。
(4)MySQL 的相关目录说明
/usr/bin : Client programs and scripts -- mysqladmin mysqldump等命令
/usr/sbin: The mysqld server
/var/lib/mysql: Log files, databases --这个目录就是数据库的目录
/usr/share/info: Manual in Info format
/usr/share/man: Unix manual pages
/usr/include/mysql: Include (header) files
/usr/lib/mysql: Libraries
/usr/share/mysql : Miscellaneous support files,including error messages, character set files, sample configuration files, SQLfor database installation
--mysql.server命令及配置文件
/usr/share/sql-bench: Benchmarks
/etc/rc.d/init.d/: 启动脚本文件mysql的目录
2.2 安装
--安装Server端:
[root@rac2 software]# ls
MySQL-client-5.5.15-1.rhel5.x86_64.rpm
MySQL-devel-5.5.15-1.rhel5.x86_64.rpm
MySQL-embedded-5.5.15-1.rhel5.x86_64.rpm
MySQL-server-5.5.15-1.rhel5.x86_64.rpm
MySQL-shared-5.5.15-1.rhel5.x86_64.rpm
MySQL-shared-compat-5.5.15-1.rhel5.x86_64.rpm
MySQL-test-5.5.15-1.rhel5.x86_64.rpm
[root@rac2 software]# rpm -ivh MySQL-server-5.5.15-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/usr/bin/mysqladmin -u root password'new-password'
/usr/bin/mysqladmin -u root -h rac2password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. This is
strongly recommended for productionservers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbugscript!
[root@rac2 software]#
--- 安装客户端
[root@rac2 software]# rpm -ivh MySQL-client-5.5.15-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ###########################################[100%]
2.3 其他操作
2.3.1 查看在时创建的mysql用户和mysql group:
[root@rac2 bin]# cat /etc/passwd|grep mysql
mysql:x:103:106:MySQLserver:/var/lib/mysql:/bin/bash
[root@rac2 bin]# cat /etc/group | grepmysql
mysql:x:106:
2.3.2 修改密码
--连接MySQL 报错:
[root@rac2 software]# mysql
ERROR 2002 (HY000): Can't connect to localMySQL server through socket '/var/lib/mysql/mysql.sock' (2)
--启动MySQL 后,在连正常:
[root@rac2 ~]# /etc/init.d/mysql start
Starting MySQL... [ OK ]
[root@rac2 init.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.15 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2010, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql>
--注意这里,因为MySQL默认没有密码,所以这里我们没有输入密码就直接连上了。
--修改密码,这个是安装Server 中提示的:
[root@rac2 ~]# /usr/bin/mysqladmin -u root password root
[root@rac2 ~]# mysql
ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: NO)
--修改密码之后,就提示要使用密码了。
[root@rac2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.15 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2010, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its affiliates. Other names may be trademarks of theirrespective owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql>
--输入密码后成功连接。
2.3.3 查看MySQL端口 3306, 这个是默认端口:
[root@rac2 ~]# netstat -nat|grep 3306
tcp 0 0 192.168.3.100:32842 192.168.3.100:3306 TIME_WAIT
tcp 0 0 :::3306 :::* LISTEN
2.3.4 设置开机自启动
--查看MySQL 开机自启动设置:
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
这里的数字分别代表Linux启动的不同模式,3是命令行,5是窗口。
--关闭开机自启动
[root@rac2 ~]# chkconfig mysql off
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:off 3:off 4:off 5:off 6:off
--启用开机自启动:
[root@rac2 ~]# chkconfig mysql on
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@rac2 ~]#
--将Mysql 从chkconfig服务里删除:
[root@rac2 ~]# chkconfig --del mysql
[root@rac2 ~]# chkconfig --list |grep mysql
--将Mysql 添加到chkconfig里:
[root@rac2 ~]# chkconfig --add mysql
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
2.4 数据库操作
[root@rac2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.15 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2010, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
--查看已经存在的数据库,这几个是安装时自动创建的
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
--使用mysql 数据库
mysql> use mysql
Reading table information for completion oftable and column names
You can turn off this feature to get aquicker startup with -A
Database changed
--查看mysql 数据库下面的表
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
24 rows in set (0.01 sec)
--创建数据库Dave
mysql> create database dave;
Query OK, 1 row affected (0.01 sec)
--在dave 数据库下面创建dave表:
mysql> use dave;
Database changed
mysql> create table dave(id int,namechar(20));
Query OK, 0 rows affected (0.01 sec)
--查看dave 表结构:
mysql> desc dave;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(20) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.00 sec)
--向dave 表里插入2条记录:
mysql> insert into davevalues(1,'dave');
Query OK, 1 row affected (0.00 sec)
mysql> insert into davevalues(2,'anqing');
Query OK, 1 row affected (0.01 sec)
mysql> select * from dave;
+------+--------+
| id | name |
+------+--------+
| 1 | dave |
| 2 | anqing |
+------+--------+
2 rows in set (0.00 sec)
--update 表:
mysql> update dave set name='david dai'where id=1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from dave;
+------+-----------+
| id | name |
+------+-----------+
| 1 | david dai |
| 2 | anqing |
+------+-----------+
2 rows in set (0.00 sec)
--drop 表:
mysql> drop table dave;
Query OK, 0 rows affected (0.01 sec)
--drop 数据库:
mysql> drop database dave;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
至此,操作结束。
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Blog: http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Email: tianlesoftware@gmail.com
Skype: tianlesoftware
一.下载说明
前期的一些准备说明,参考:
MySQL 发展史
http://blog.csdn.net/tianlesoftware/article/details/6999245
Mysql 不同版本 说明
http://blog.csdn.net/tianlesoftware/article/details/6723117
MySQL 分为Community Server 和 Enterprise Edition。 其中Community Server 可以直接从mysql 的官网下载。Enterprice Edition 只能从Oracle edelivery上下载,不过Edelivery 现在。
1.1 官方文档上有关MySQL安装文件类型说明:
http://dev.mysql.com/doc/refman/5.5/en/index.html
Linux supports anumber of different solutions for installing MySQL. The recommended method isto use one of the distributions from Oracle. If you choose this method, thereare three options available:
(1)Installingfrom a generic binary package in .tar.gz format. See Section 2.2,“Installing MySQL from Generic Binaries on Unix/Linux” for moreinformation.
(2)Extractingand compiling MySQL from a source distribution. For detailed instructions,see Section 2.9, “InstallingMySQL from Source”.
(3)Installingusing a pre-compiled RPM package. For more information on using the RPMsolution, see Section 2.5.1,“Installing MySQL from RPM Packages on Linux”.
--这里讲了3种方式来安装MySQL数据库,我这里用最简单的RPM 包来安装。
As analternative, you can use the native package manager within your Linuxdistribution to automatically download and install MySQL for you. Nativepackage installations can take of the download and dependencies required to runMySQL, but the MySQL version will often be some way behind the currentlyavailable release. You will also normally be unable to install developmentalreleases, as these are not usually made available in the native repository. Formore information on using the native package installers, see Section 2.5.2,“Installing MySQL on Linux using Native Package Manager”.
Note
For many Linux installations,you will want to set up MySQL to be started automatically when your machinestarts. Many of the native package installations perform this operation foryou, but for source, binary and RPM solutions you may need to set this upseparately. The required script, mysql.server,can be found in the support-filesdirectory under the MySQL installationdirectory or in a MySQL source tree. You can install itas/etc/init.d/mysql for automatic MySQL startup and shutdown. See Section 2.10.1.2,“Starting and Stopping MySQL Automatically”.
--这里要注意一个问题,就是设置MySQL的自启动。 如果使用native package来安装,会自动设置为自启动,如果使用其他的方式,如source,binary和RPM,就需要单独的来设置自启动。
1.2 下载安装包
我这里下载Community Server 版的,Enterprise Edition版的请到Oracle E-Delivery上下载。Enterprise Edition 有30天的试用期。
Community Server下载地址:http://www.mysql.com/downloads/mysql/
这里要注意的,MySQL的Tar 包还是比较大,要比RPM包大3倍左右。
MySQL 的RPM 包有如下几个:
看一下每个rpm 包具体的描述:
(1)MySQL-server-VERSION.glibc23.i386.rpm
The MySQLserver. You need this unless you only want to connect to a MySQL server runningon another machine.
(2)MySQL-client-VERSION.glibc23.i386.rpm
The standardMySQL client programs. You probably always want to install this package.
(3)MySQL-devel-VERSION.glibc23.i386.rpm
The librariesand include files that are needed if you want to compile other MySQL clients,such as the Perl modules.
(4)MySQL-debuginfo-VERSION.glibc23.i386.rpm
This packagecontains debugging information. debuginfo RPMs are never needed touse MySQL software; this is true both for the server and for client programs.However, they contain additional information that might be needed by a debuggerto analyze a crash.
(5)MySQL-shared-VERSION.glibc23.i386.rpm
This packagecontains the shared libraries (libmysqlclient.so*) that certain languages andapplications need to dynamically load and use MySQL. It containssingle-threaded and thread-safe libraries. Prior toMySQL 5.5.6, if you install this package, do not installthe MySQL-shared-compat package.
(6)MySQL-shared-compat-VERSION.glibc23.i386.rpm
This packageincludes the shared libraries for MySQL 3.23, 4.0, and so on. It containssingle-threaded and thread-safe libraries. Install this package if you have applicationsinstalled that are dynamically linked against older versions of MySQL but youwant to upgrade to the current version without breaking the librarydependencies. Before MySQL 5.5.6, MySQL-shared-compat also includesthe libraries for the current release, so if you install it, you should notalso install MySQL-shared. As of 5.5.6, MySQL-shared-compat doesnot include the current library version, so there is no conflict.
(7)MySQL-embedded-VERSION.glibc23.i386.rpm
The embeddedMySQL server library.
(8)MySQL-test-VERSION.glibc23.i386.rpm
This packageincludes the MySQL test suite.
(9)MySQL-VERSION.src.rpm
This containsthe source code for all of the previous packages. It can also be used torebuild the RPMs on other architectures (for example, Alpha or SPARC).
二. 安装MySQL
2.1 安装说明
(1)MySQL的安装包有很多个,作用也不同,在大多数情况下,只需要安装MySQL-server 和 MySQL-client,其他的包根据需要来安装。
(2)The server RPM places data underthe /var/lib/mysql directory. The RPM also creates a login accountfor a user named mysql (if one does not exist) to use for running theMySQL server, and creates the appropriate entries in /etc/init.d/ tostart the server automatically at boot time. (This means that if you haveperformed a previous installation and have made changes to its startup script,you may want to make a copy of the script so that you do not lose it when youinstall a newer RPM.)
(3)During RPM installation, a usernamed mysql and a group named mysql are created on thesystem. This is done using the useradd, groupadd,and usermod commands. Those commands require appropriateadministrative privileges, which is required for locally managed users andgroups (as listed in the /etc/passwd and /etc/groupfiles) by theRPM installation process being run by root.
--在MySQL 安装时,会创建mysql 用户和mysql组。
(4)MySQL 的相关目录说明
/usr/bin : Client programs and scripts -- mysqladmin mysqldump等命令
/usr/sbin: The mysqld server
/var/lib/mysql: Log files, databases --这个目录就是数据库的目录
/usr/share/info: Manual in Info format
/usr/share/man: Unix manual pages
/usr/include/mysql: Include (header) files
/usr/lib/mysql: Libraries
/usr/share/mysql : Miscellaneous support files,including error messages, character set files, sample configuration files, SQLfor database installation
--mysql.server命令及配置文件
/usr/share/sql-bench: Benchmarks
/etc/rc.d/init.d/: 启动脚本文件mysql的目录
2.2 安装
--安装Server端:
[root@rac2 software]# ls
MySQL-client-5.5.15-1.rhel5.x86_64.rpm
MySQL-devel-5.5.15-1.rhel5.x86_64.rpm
MySQL-embedded-5.5.15-1.rhel5.x86_64.rpm
MySQL-server-5.5.15-1.rhel5.x86_64.rpm
MySQL-shared-5.5.15-1.rhel5.x86_64.rpm
MySQL-shared-compat-5.5.15-1.rhel5.x86_64.rpm
MySQL-test-5.5.15-1.rhel5.x86_64.rpm
[root@rac2 software]# rpm -ivh MySQL-server-5.5.15-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/usr/bin/mysqladmin -u root password'new-password'
/usr/bin/mysqladmin -u root -h rac2password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. This is
strongly recommended for productionservers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbugscript!
[root@rac2 software]#
--- 安装客户端
[root@rac2 software]# rpm -ivh MySQL-client-5.5.15-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ###########################################[100%]
2.3 其他操作
2.3.1 查看在时创建的mysql用户和mysql group:
[root@rac2 bin]# cat /etc/passwd|grep mysql
mysql:x:103:106:MySQLserver:/var/lib/mysql:/bin/bash
[root@rac2 bin]# cat /etc/group | grepmysql
mysql:x:106:
2.3.2 修改密码
--连接MySQL 报错:
[root@rac2 software]# mysql
ERROR 2002 (HY000): Can't connect to localMySQL server through socket '/var/lib/mysql/mysql.sock' (2)
--启动MySQL 后,在连正常:
[root@rac2 ~]# /etc/init.d/mysql start
Starting MySQL... [ OK ]
[root@rac2 init.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.15 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2010, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql>
--注意这里,因为MySQL默认没有密码,所以这里我们没有输入密码就直接连上了。
--修改密码,这个是安装Server 中提示的:
[root@rac2 ~]# /usr/bin/mysqladmin -u root password root
[root@rac2 ~]# mysql
ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: NO)
--修改密码之后,就提示要使用密码了。
[root@rac2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.15 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2010, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its affiliates. Other names may be trademarks of theirrespective owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql>
--输入密码后成功连接。
2.3.3 查看MySQL端口 3306, 这个是默认端口:
[root@rac2 ~]# netstat -nat|grep 3306
tcp 0 0 192.168.3.100:32842 192.168.3.100:3306 TIME_WAIT
tcp 0 0 :::3306 :::* LISTEN
2.3.4 设置开机自启动
--查看MySQL 开机自启动设置:
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
这里的数字分别代表Linux启动的不同模式,3是命令行,5是窗口。
--关闭开机自启动
[root@rac2 ~]# chkconfig mysql off
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:off 3:off 4:off 5:off 6:off
--启用开机自启动:
[root@rac2 ~]# chkconfig mysql on
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@rac2 ~]#
--将Mysql 从chkconfig服务里删除:
[root@rac2 ~]# chkconfig --del mysql
[root@rac2 ~]# chkconfig --list |grep mysql
--将Mysql 添加到chkconfig里:
[root@rac2 ~]# chkconfig --add mysql
[root@rac2 ~]# chkconfig --list |grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
2.4 数据库操作
[root@rac2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.15 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2010, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
--查看已经存在的数据库,这几个是安装时自动创建的
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
--使用mysql 数据库
mysql> use mysql
Reading table information for completion oftable and column names
You can turn off this feature to get aquicker startup with -A
Database changed
--查看mysql 数据库下面的表
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
24 rows in set (0.01 sec)
--创建数据库Dave
mysql> create database dave;
Query OK, 1 row affected (0.01 sec)
--在dave 数据库下面创建dave表:
mysql> use dave;
Database changed
mysql> create table dave(id int,namechar(20));
Query OK, 0 rows affected (0.01 sec)
--查看dave 表结构:
mysql> desc dave;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(20) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.00 sec)
--向dave 表里插入2条记录:
mysql> insert into davevalues(1,'dave');
Query OK, 1 row affected (0.00 sec)
mysql> insert into davevalues(2,'anqing');
Query OK, 1 row affected (0.01 sec)
mysql> select * from dave;
+------+--------+
| id | name |
+------+--------+
| 1 | dave |
| 2 | anqing |
+------+--------+
2 rows in set (0.00 sec)
--update 表:
mysql> update dave set name='david dai'where id=1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from dave;
+------+-----------+
| id | name |
+------+-----------+
| 1 | david dai |
| 2 | anqing |
+------+-----------+
2 rows in set (0.00 sec)
--drop 表:
mysql> drop table dave;
Query OK, 0 rows affected (0.01 sec)
--drop 数据库:
mysql> drop database dave;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
至此,操作结束。
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Blog: http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Email: tianlesoftware@gmail.com
Skype: tianlesoftware
发表评论
-
mysql主从备份+keepalived自动切换
2019-08-14 14:21 519转自:https://www.cnblogs.com/wat ... -
linux修改密码
2019-07-15 16:49 428修改当前用户密码:sudo passwd 修改root用户 ... -
如何查看linux是32位还是64位
2019-07-01 09:35 425使用命令 “getconf LONG_B ... -
mysql5.7 virtual关键字
2018-11-01 18:09 807mysql5.7 中新增了virtual关键字,所以以前 ... -
linux下面/usr/local和opt目录有何区别
2018-09-30 11:26 1045转自:http://blog.51cto.com/myste ... -
acid与acp
2018-09-30 11:09 1009传统关系型数据库事 ... -
数据库优化
2018-09-28 16:10 360数据库瓶颈: 连接数 处理能力 存储量 优化 ... -
mysql拆分
2018-06-11 10:31 409数据库拆分有两种方式:垂直拆分和 水平拆分 垂直拆 ... -
linux下tail -f加过滤
2017-07-17 11:25 1098在查看服务器日志时,服务器日志过多,这时可以使用grep命令 ... -
数据库优化
2016-08-17 11:13 416引自:http://shensy.iteye. ... -
Mysql中limit的用法详解
2016-08-05 11:31 397Mysql中limit的用法:在我们使用查询语句的时候,经 ... -
Linux关机命令详解
2014-01-29 10:50 468转自:http://www.jb51.net/os/Red ... -
MySQL日期数据类型、时间类型使用总结
2013-09-04 11:30 876详细出处参考:http://ww ... -
SQL 拼接、替换、判断字符串包含
2013-06-25 16:58 1492Sql的字符串相加: Upd ... -
linux下查看cpu及操作系统信息
2013-06-21 17:07 737# uname -aLinux ylin-ThinkPad 2 ... -
CentOS下配置iptables防火墙
2013-05-10 16:55 712转自:http://os.51cto.com/art/20 ... -
mysql备份、还原
2013-05-03 17:04 774备份: mysqldump powermail_4 -h lo ... -
Linux下mysql修改连接超时
2013-04-24 11:17 15241,首先进入mysql,查看 wait_timeout、int ... -
linux重启MYSQL的命令
2013-04-24 10:44 10098如何启动/停止/重启MySQL 一、启动方式 1、使用 s ... -
MySql常用命令总结
2013-04-24 10:41 6161:使用SHOW语句找出在服 ...
相关推荐
### Linux下Mysql5.5的Cmake安装以及sphinx结合 #### 一、Mysql5.5在Linux下的Cmake安装步骤 ##### 1. 用户与权限设置 首先需要为MySQL服务创建一个专用的用户账号,这有助于提高系统的安全性。 ```shell # 创建...
本文将详细介绍MySQL 5.5的安装过程以及与之相关的jar包知识。 首先,安装MySQL 5.5的步骤如下: 1. **下载安装文件**:你需要从官方网站或可靠的第三方源获取MySQL 5.5的安装程序。安装文件通常为.exe格式,适用...
### MySQL 5.5 安装与配置教程详解 #### 一、MySQL 5.5 安装前的准备工作 在开始安装 MySQL 5.5 之前,我们需要确保系统环境符合以下条件: 1. **操作系统**:本教程适用于基于 Red Hat 的 Linux 发行版(如 ...
"mysql5.5.txt" 文件可能包含了教程、示例脚本或练习材料,这些资源将有助于加深你对 MySQL 5.5 的理解。在学习过程中,不断实践和探索,理论与实际相结合,你将能够快速掌握 MySQL 5.5 的核心技能。
#### 2.4 在 Linux 下安装 MySQL - **命令行操作**:详细介绍了通过命令行工具进行 MySQL 安装的方法。 - **包管理器**:利用系统自带的包管理工具简化安装过程。 #### 2.5 在 MacOSX 中安装 MySQL - **安装包**:...
- **平台兼容性**:MySQL 5.5支持多种操作系统,包括Linux/Unix、macOS X、Windows和Solaris等,为跨平台部署提供了灵活性。 - **服务器选项与变量参考**:深入介绍了MySQL服务器的配置选项和运行时变量,帮助管理...
### CentOS 6.5 + JDK 1.7 + MySQL 5.5 + Tomcat 7 + Nginx 1.7 安装手册 #### 一、JDK 1.7 安装 ##### 1.1 下载JDK 1.7 - 访问Oracle官方下载页面:...
"一键LAMP(MySQL分离)(Apache2.2+MySQL5.5+PHP5.3)"是一个关于在Linux系统上快速安装和配置LAMP(Linux、Apache、MySQL、PHP)服务器环境的教程,其中特别强调了MySQL数据库的独立安装与管理。这个教程可能包含...
- **Windows下安装后的过程**:在Windows平台上安装MySQL后还需要进行一些额外的设置。 - **Unix下安装后的过程**:Unix平台上的MySQL安装后需要进行相应的配置和测试。 以上是对“MySQL 5.5参考手册(中文)”部分...
在Linux平台上安装MySQL数据库是一个常见的任务,特别是在互联网环境中,MySQL作为流行的关系型数据库管理系统,被广泛应用于网站开发、数据存储等场景。以下是基于提供的文件内容的详细步骤和知识点: 1. **MySQL...
标题中的"qsqlmysql-win32-qt4.8.4-mysql5.5.zip"表明这是一个用于Windows 32位系统的压缩包,它包含了Qt 4.8.4版本的QSQLMySQL模块,该模块是Qt库的一部分,用于与MySQL 5.5数据库系统进行交互。这个压缩包很可能是...
《一键LNMP(MySQL分离):Nginx 1.13+MySQL 5.5+PHP 5.3 安装与配置指南》 在IT行业中,搭建LNMP(Linux + Nginx + MySQL + PHP)环境是常见的任务,尤其对于Web服务器的配置和管理。本篇文章将深入探讨如何在...
在本教程中,我们将详细介绍如何在 CentOS Linux release 7.9.2009 上安装 MySQL 5.7.37。首先,我们要确保系统中没有预装的 MariaDB 或其他 MySQL 版本,因为它们可能与新安装的 MySQL 冲突。 1. 卸载预装的 ...
### Linux下MySQL源码安装与简单使用 #### 源码安装原因 在某些Linux发行版中,并不自带MySQL数据库,或因特定硬件架构(例如国产龙芯等基于MIPS指令集的处理器)而不支持MySQL官方提供的RPM包安装方式。这种情况...
在Linux环境下,MySQL集群的安装是一个涉及多步骤的过程,它能够提供高可用性和数据冗余。这里将详细讲解如何在CentOS 5.5上安装MySQL集群。 首先,你需要下载MySQL集群的安装文件,例如`mysql-cluster-gpl-7.1.10-...
在Linux系统中安装MySQL数据库是DBA和系统管理员的基本技能之一。根据提供的文件内容,以下是在Linux系统中安装MySQL数据库的知识点。 ### Linux系统中MySQL数据库安装的基本流程 1. **获取MySQL安装包**: - 从...
MySQL 5.5.56是这个开源数据库软件的一个特定版本,专为基于Linux的系统设计,特别是那些使用glibc 2.5库的系统。i686代表了32位Intel处理器架构,这意味着这个版本适用于32位的Linux环境。 MySQL 5.5系列是MySQL...
在Red Hat Linux操作系统中,源码安装MySQL是一个相对复杂的过程,因为这涉及到手动编译、配置和安装。以下是一步步的详细步骤: 1. **下载MySQL服务器和客户端**: 首先,你需要访问MySQL的官方网站...