1、安装mysql-server:
hadoop@stcn501a0166:~$ mysql
程序 'mysql' 已包含在下列软件包中:
* mysql-client-core-5.5
* mariadb-client-core-5.5
* mysql-client-core-5.6
* percona-xtradb-cluster-client-5.5
请尝试:sudo apt-get install <选定的软件包>
hadoop@stcn501a0166:~$ sudo apt-get install mysql-server
[sudo] password for hadoop:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
程序 'mysql' 已包含在下列软件包中:
* mysql-client-core-5.5
* mariadb-client-core-5.5
* mysql-client-core-5.6
* percona-xtradb-cluster-client-5.5
请尝试:sudo apt-get install <选定的软件包>
hadoop@stcn501a0166:~$ sudo apt-get install mysql-server
[sudo] password for hadoop:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
说明:遇到输入的地方输入Y,过程中需要设置root用户的密码,设置时记住密码
2、root用户登录:
hadoop@stcn501a0166:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)
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.
mysql>
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)
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.
mysql>
3、查看系统中的数据库:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql>
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql>
4、新建测试用数据库:
mysql> create database example;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| example |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
mysql>
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| example |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
mysql>
5、创建新的用户帐号:
mysql> create user 'mzuser'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on example.* To 'mzuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on example.* To 'mzuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)
说明:给用户赋予在example数据库上的权限
6、使用新用户登录
hadoop@stcn501a0166:~$ mysql -u mzuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)
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.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| example |
+--------------------+
2 rows in set (0.00 sec)
mysql>
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)
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.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| example |
+--------------------+
2 rows in set (0.00 sec)
mysql>
7、修改用户访问的数据库并查看库中表
mysql> use example
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> exit
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> exit
由于新创建的库中没有任何表,所以显示为empty
8、退出登录并关闭数据库服务:
sql>exit
~$sudo /etc/init.d/mysql stop
9、测试创建表(使用新建用户登录,use example数据库)
mysql> create table CmsUser(
> userid int(8) not null auto_increment primary key,
>username varchar(20) not null,
> password varchar(20),
> area varchar(10),
>deptrole varchar(10));
Query OK, 0 rows affected (0.06 sec)
mysql> show tables;
+-------------------+
| Tables_in_example |
+-------------------+
| CmsUser |
+-------------------+
1 row in set (0.00 sec)
> userid int(8) not null auto_increment primary key,
>username varchar(20) not null,
> password varchar(20),
> area varchar(10),
>deptrole varchar(10));
Query OK, 0 rows affected (0.06 sec)
mysql> show tables;
+-------------------+
| Tables_in_example |
+-------------------+
| CmsUser |
+-------------------+
1 row in set (0.00 sec)
相关推荐
Ubuntu下安装mysql5.7.19源码,过程详细。。。。。。。。。。。。。。。。。。。。
2 内置可以在存储过程中执行Linux命令插件 3 安装完成后,cd /auto/mysql/support-files/, ./mysql.xs.server start 是启动 ./mysql.xs.server stop 是停止 ./mysql.xs.server status 是查状态 ./mysql.xs.server ...
Ubuntu 通过Deb 安装 MySQL 5.5 描述了整个过程 亲测可用
一个小白买的腾讯云服务器,安装mysql,在 Ubuntu 上安装 MySQL,最简单的方式是在线安装。 ```shell #安装 MySQL 服务端、核心程序 sudo apt-get install mysql-server #安装 MySQL 客户端 sudo apt-get install ...
Ubuntu安装mysql和sqlite3,里边详细讲解了安装的过程,一步一步的教你怎么安装mysql及sqlite3
ubuntu下交叉编译mysql的C语言程序到ARM开发板,文档中有详细具体步骤。
自己在安装和使用mysql过程中总结的各种问题,希望帮到你,还不会的可以联系我 decoderworld@126.com
Ubuntu下MySQL安装及配置文档,自己安装MySQL5.6.17过程整理的 内容如下 Ubuntu12.04下MySQL安装配置 一.MySQL安装 2 二.MySQL开机自启动设置 4 三.MySQL常用操作 5 四.编码配置 8 五.更改mysql的数据库目录 10 六....
第一步 将MySQL JDBC驱动程序安装“mysql-...第二步 在终端中输入 sudo dpkg -i mysql-connector-j_8.0.31-1ubuntu22.04_all.deb 命令安装该驱动程序 第三步 程序被安装到/usr/share/java目录下,可以前往查看
服务器上没做数据库的自动备份,那你就等着删库跑路了,文章教你如何在ubuntu、centos服务器上自动备份mysql,按步骤复制粘贴即可!
一、ubuntu安装mysql 首先查看是否安装过MySQL sudo netstat -tap|grep mysql 安装 sudo apt-get install mysql-server (安装过程中会提示设置密码什么的) apt-get update 更新软件包 apt-get upgrade 升级...
在Ubuntu中j为java程序运行时所需要得MySQL数据库进行安装和配置
当然,MySQL的安装方法多种多样,在Ubuntu上,你可以采用apt-get的方式安装,这样的好处是:快速方便。基本上,它会帮你解决所有的函数库依赖问题,正常情况下,只要apt-get执行完成,那么MySQL也就可以使用了。 但...
在Ubuntu 18.04上安装MySQL:逐步指南,说明如何在Ubuntu 18.04上安装MySQL。 在CentOS 7上安装MySQL:逐步指南,说明如何在CentOS 7上安装MySQL。 如何重置MySQL root密码:解释如何使用mysqld_safe或跳过授权表的...
主要为大家详细介绍了Ubuntu手动安装mysql5.7.10的详细过程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
ubuntu上安装mysql非常简单只需要几条命令就可以完成。 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client 3. sudo apt-get install libmysqlclient-dev 安装过程中会提示设置密码什么的,...
gec6818arm开发板和Ubuntu中安装并且编译移植mysql驱动连接QT执行程序 安装教程看博客:http://t.csdn.cn/PyxpJ -----------------------------------------------------------------------------------------------...
以下是 MySQL 数据库在 Ubuntu 系统上的安装和配置教程: ### 步骤 1: 安装 MySQL 1. 打开终端,并执行以下命令安装 MySQL 服务器: ``` sudo apt update sudo apt install mysql-server ``` 2. 在安装过程中...
本文为大家分享了mysql 8.0安装配置方法,供大家参考,具体...阅读了一下MySQL安装指南,发现MySQL5.7版本最高只适配到Ubuntu17.04,而MySQL8.0最高适配到Ubuntu18.04。 So,去 MySQL APT Repository.下载一个mysql-
- 在安装过程中,可以选择是否安装MySQL服务,并设置管理员密码。 - macOS系统: - 打开终端,并使用Homebrew包管理器安装MySQL。运行以下命令: ``` brew install mysql ``` - 安装完成后,MySQL将自动启动...