09 Mysql数据库在Linux下的使用
1. 创建数据库
1.1 启动Mysql
[root@localhost ~]# mysql -h127.0.0.1 -uroot -pmysql
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 4
Server version: 5.6.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
1.2 创建数据库
mysql> create database Kevindb1;
Query OK, 1 row affected (0.08 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| Kevindb1 |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.01 sec)
mysql>
2. 创建数据表
mysql> use Kevindb1;
Database changed
mysql> create table users(userID varchar(8),userName varchar(8));
Query OK, 0 rows affected (0.35 sec)
mysql> show tables;
+--------------------+
| Tables_in_Kevindb1 |
+--------------------+
| users |
+--------------------+
1 row in set (0.00 sec)
3. 在user表中插入数据
mysql> insert into users values('0001','Tom');
Query OK, 1 row affected (0.08 sec)
mysql> insert into users values('0002','James');
Query OK, 1 row affected (0.04 sec)
mysql> select * from users;
+--------+----------+
| userID | userName |
+--------+----------+
| 0001 | Tom |
| 0002 | James |
+--------+----------+
2 rows in set (0.00 sec)
4. 查看表结构
mysql> desc users;
+----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------+------+-----+---------+-------+
| userID | varchar(8) | YES | | NULL | |
| userName | varchar(8) | YES | | NULL | |
+----------+------------+------+-----+---------+-------+
2 rows in set (0.07 sec)
09 Mysql数据库在Linux下的使用的更多相关文章
- MySQL数据库乱码 - Linux下乱码问题一
乱码问题是很让人抓狂的问题,下面我将记录一下linux下mysql乱码问题的解决方法. mysql在linux下乱码问题 一.操作 mysql默认字符集是latin1,但是我们大部分程序使用的字符集是 ...
- mysql数据库在Linux下安装与配置
mysql是一种开放源代码的关系型数据库系统(RDBMS),使用最常用的数据库管理语言--结构化查询语句(SQL)进行数据库管理. 由于mysql的开源,因此任何人都可以在General Publ ...
- mysql数据库在linux下的导出和导入及每天的备份
mysql数据库的导出,导入 1. 导出数据库为sql文件 mysqldump 数据库名 -uroot -p > xxx.sql 导出数据表结构和数据 eg. mysqldump cloud ...
- 【mysql数据库】Linux下mysql安装连接全过程(含有问题详解)
本次安装操作在腾讯云上实现(版本:CentOS Linux release 7.4.1708 (Core) ). 根据教程实现(中途各种挖坑,填坑...),地址:http://www.runoob.c ...
- windows下的mysql迁移到linux下
最近做毕业设计,需要把windows下的mysql移植到linux下 曾经有过在window下移植mysql数据库的经验,只需要把msql的数据文件复制到另一台安装mysql的机器的数据存放位置,然后 ...
- MySQL入门——在Linux下安装和卸载MySQL
MySQL入门——在Linux下安装和卸载MySQL 摘要:本文主要学习了如何在Linux系统中安装和卸载MySQL数据库. 查看有没有安装过MySQL 使用命令查看有没有安装过: [root@loc ...
- MySQL入门——在Linux下安装和卸载MariaDB
MySQL入门——在Linux下安装和卸载MariaDB 摘要:本文主要学习了如何在Linux系统中安装和卸载MariaDB数据库. 查看有没有安装过MariaDB 使用命令查看有没有安装过: [ro ...
- MySQL数据库InnoDB引擎下服务器断电数据恢复
说明: 线上的一台MySQL数据库服务器突然断电,造成系统故障无法启动,重新安装系统后,找到之前的MySQL数据库文件夹. 问题: 通过复制文件的方式对之前的MySQL数据库进行恢复,发现在程序调用时 ...
- 【MySql】在Linux下安装MySql数据库
[参数环境] 1.Host OS:Win7 64bit 2.VM: VMware 11.1.0 3.Client OS:CentOS 6 4.系统中已安装的openssl版本: openssl-1.0 ...
随机推荐
- selenium Gird
selenium-server selenium Gird testcase-----------------hub -------------------node1 ---------------- ...
- Core Java Volume I — 4.1. Introduction to Object-Oriented Programming
4.1. Introduction to Object-Oriented ProgrammingObject-oriented programming, or OOP for short, is th ...
- centos6.4安装配置vpn服务器步骤详解
centos6.4安装配置vpn服务器步骤详解,从安装VPN到配置VPN服务器.配置VPN服务器的路由转发功能,每一步都很详细 一.VPN服务器环境说明 操作系统:CentOS release ...
- asp.net网站 提示Ambiguous match found
在ASP.net中,每个aspx页面都会有一个.cs文件,(好像不可以多个aspx共用一个cs的,我前面就碰到这个问题), 在aspx页面中,我们会用到服务器控件,或html控件,这些控件的id命名时 ...
- iOS学习笔记---C语言第三天
循环结构 : while循环 do...while循环(几乎不用) for循环(使用最多) 特点:在给定的条件成立时,反复执行某程序段,直到条件不成立为止. 给定的条件为循环条件,反复执行 ...
- 简单插入排序(C++版)
#include <iostream> using namespace std; /** \ Insert Sort * * Key: * * reserve: tm = a[i] * * ...
- Centos搭建openvpn+mysql数据库认证
服务器环境说明 1.系统版本 CentOS release 5.10 (Final) 64bits 2.软件版本 openvpn-2.3.6-1.el5 lzo-2.02-2.el5.1 lzo-d ...
- POJ 3264 区间最大最小值Sparse_Table算法
题目链接:http://poj.org/problem?id=3264 Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total ...
- leetcode 92 Reverse Linked List II ----- java
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1-> ...
- 《剑指Offer》之二维数组中的查找
1.题目描述 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数. 2.代码实现 pu ...