mysql 如何启动。。。。。。

博客分类:
我使用过的Linux命令之mysql - MySQL客户端命令行工具
本文链接:
(转载请注明出处)
mysql命令是用来连接MySQL服务器并执行用户命令行的工具,如果使用MySQL作为数据库,那这个命令就是经常需要用到的了。本文只简单讲述mysql命令行的使用,以及在shell脚本中的应用,不涉及mysql的安装和SQL语法介绍。
格式:mysql
使用mysql连接数据库,只有在本机启动了mysql服务器,访问密码还没有设置的情况下才能连接成功。当然,还有一种情况就是在/etc/my.cnf的[mysql]节配置了user和password项的时候也可以做到。
格式:mysql -p
使用当前Linux登录用户连接mysql服务器,提示输入密码。
格式:mysql -pxxxxxx
使用当前Linux登录用户连接mysql服务器,密码为xxxxxx。
格式:mysql -uxxx -pxxxxxx
使用用户xxx,密码xxxxxx来连接mysql服务器。
格式:mysql -uxxx -pxxxxxx -hhostname
使用用户xxx,密码xxxxxx来连接运行在由hostname指定的主机上的mysql服务器。
安静模式,减少输出,比如表头(Silent mode. Produce less output.)。
输出的信息不进行转义,如果没有此参数,某些特殊字符将会被转义(Newline, tab, NUL, and backslash are written as \n, \t, \0, and \\.)
输出为表格形式(Display output in table format),在命令行方式默认输出为表格形式。但是作为脚本时如果要输出为表格形式那么就必须加上此参数。
输出为HTML形式(Produce HTML output.)。
[root@node34 root]# mysql
Welcome to the MySQL monitor.
Your MySQL connection id is 8 to server version: 3.23.58-log
Type '' or '\h' for help. Type '\c' to clear the buffer.
mysql& quit
[root@node34 root]#
示例二 访问MySQL数据库的脚本
有时候觉得访问mysql时总是要输入用户和密码、主机之类的很烦,索性就写一个简单的shell脚本来访问它。
文件:db.sh
mysql -pxxxxxx -uroot -h192.168.6.xx exam "$@"
[root@web exam_server]# ./db.sh
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.
Your MySQL connection id is 14687
Server version: 5.1.48-community-log MySQL Community Server (GPL)
Copyright (c) , Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type '' or '\h' for help. Type '\c' to clear the current input statement.
mysql& quit
[root@web exam_server]#
下面的命令将mysql的查询结果输出为HTML文本,这个可以用在shell脚本中。
[root@web exam_server]# ./db.sh -H &&EOF
&TABLE BORDER=1&&TR&&TH&Tables_in_exam&/TH&&/TR&&TR&&TD&exam_paper_info&/TD&&/TR&&TR&&TD&exam_paper_question&/TD&&/TR&&TR&&TD&exam_question_info&/TD&&/TR&&TR&&TD&exam_user_answer&/TD&&/TR&&TR&&TD&exam_user_info&/TD&&/TR&&TR&&TD&exam_user_paper&/TD&&/TR&&/TABLE&
下面的命令将mysql的查询结果输出为表格形式,这个可以用在shell脚本中。注:在shell脚本中要输出表格形式,必须加上-t参数。
[root@web exam_server]# ./db.sh -t &&EOF&
select count(*) as "未评分数量", count(distinct question_seq) as "未评分题数"&
from exam_user_answer&
+------------+------------+
| 未评分数量 | 未评分题数 |
+------------+------------+
+------------+------------+
[root@web exam_server]#
浏览 15386
codingstandards
浏览: 3466376 次
来自: 上海
如果有A进程原代码情况下,通过如下调用,把他的子进程继承关闭则 ...
楼主咋没分析下源码呢?
tail -F 就可以吧
新手学习了,就是不明白为一个网卡配多个ip有什么用
不错,谢谢!
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'下载 mysql-5.1.51.tar.gz - MySQL - 下载 - 自由软件库 - ChinaUnix.net
本类周下载TOP10
本类总下载TOP10
您的位置:->->->MySQL
操作系统&&Linux&&BSD&&Solaris系统相关&&管理工具&&通讯交流&&桌面相关&&文件管理&&操作系统&&安全工具&&硬件相关网络互连&&电子邮件&&FTP服务器&&HTTP服务器&&网络浏览&&聊天工具&&上传下载&&镜像备份&&X窗口系统&&远程登陆&&其他服务&&网络安全&&新闻组开发工具&&开发语言&&库文件&&编译工具&&版本控制&&数据库开发&&优化调试&&IDE环境&&其他工具应用程序&&数据库&&教育培训&&商业金融&&办公套件&&文本处理&&科学工程&&信息管理&&其他软件&&论坛程序&&Wiki程序&&Blog相关&&建站管理&&项目管理多媒体工具&&音频工具&&图形图像&&视频工具游戏娱乐&&益智类&&棋牌类&&动作类&&RPG类&&策略类&&模拟器&&相关工具资料视频&&网络技术&&服务器存储&&Linux安全&&《开源时代》
首字母搜索
软件名称:
下载文件:
mysql-5.1.51.tar.gz
&Linux最新资讯&
&IT最新资讯&
Copyright &
ChinaUnix.net
All Rights Reserved
感谢所有关心和支持过ChinaUnix的朋友们MySQL :: MySQL DocumentationMySQL :: Download MySQL Community Server
The world's most popular open source database
Download MySQL Community Server
MySQL open source software is provided under the
OEMs, ISVs and VARs can purchase commercial licenses.
MySQL Community Edition is a freely downloadable version of the world's most popular open source database that is supported by an active community of open source developers and enthusiasts. is available as a separate download. The reason for this change is so that MySQL Cluster can provide more frequent updates and support using the latest sources of MySQL Cluster Carrier Grade Edition.
MySQL 5.7 is the most current GA release.
and view the .
Online Documentation:
for the MySQL 5.7 Generally Available (GA) Release
for the MySQL 5.6 Generally Available (GA) Release
for the MySQL 5.5 Generally Available (GA) Release
Looking for previous GA versions?
Please report any bugs or inconsistencies you observe to our .Thank you for your support!
MySQL Community Server 5.7.20
Select Operating System:
Select Operating System&
Microsoft Windows
Ubuntu Linux
Debian Linux
SUSE Linux Enterprise Server
Red Hat Enterprise Linux / Oracle Linux
Linux - Generic
Oracle Solaris
Source Code
Select OS Version:
Windows (x86, 32-bit)
Windows (x86, 64-bit)
Recommended Download:
Other Downloads:
Windows (x86, 32-bit), ZIP Archive
(mysql-5.7.20-win32.zip)
MD5: e65ec6b83d51dabbc0e3c18 |
Windows (x86, 64-bit), ZIP Archive
(mysql-5.7.20-winx64.zip)
MD5: 0effc0c5434 |
Windows (x86, 32-bit), ZIP ArchiveDebug Binaries & Test Suite
(mysql-5.7.20-win32-debug-test.zip)
MD5: 8be460ae24e9ac2a2ee7c |
Windows (x86, 64-bit), ZIP ArchiveDebug Binaries & Test Suite
(mysql-5.7.20-winx64-debug-test.zip)
MD5: eca7bccaed755 |
We suggest that you use the
to verify the integrity of the packages you download.

我要回帖

更多关于 navicat for mysql 的文章

 

随机推荐