RH134-第二十节-Mariadb数据库

2023-12-28 08:58

本文主要是介绍RH134-第二十节-Mariadb数据库,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

安装数据库

yum install mariadb-server.x86_64 -y
systemctl start mariadb
systemctl enable mariadb
vim /etc/my.cnf
skip-networking=1
mysql_secure_installation
Enter

进入数据库

mysql -uroot -p ##登陆数据库
show databases; ##显示所有数据库
mysql -uroot -phubo -e ”show databases;“ ##直接查看所有数据库
use westos; ##使用westos数据库
show tables; ##显示表格
select * from linux; ##从linux表格里获取所有信息


[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| linux |
| mysql |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [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.00 sec)

MariaDB [mysql]> select * from user

创建数据库

create database westos;
use westos;
careat table linux ( ## (表示换行
name varchar(50) not null, ##表示not null不能为空
age varchar(50) not null,
school varchar(50) not null,
sex varchar(20) ); ## 没有not null 表示录入的时候这一项可以为空
insert into linux values (‘lee’,’25’,’xupt’,’man’);
select * from linux;


[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
MariaDB [linux]> show tables ;
Empty set (0.00 sec)

MariaDB [linux]> create table mn (
-> age varchar(50),
-> sex varchar(50),
-> school varchar(20));
Query OK, 0 rows affected (0.36 sec)

MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| mn |
+—————–+

MariaDB [linux]> insert into mn (‘20’,’man’,’XUPT’); ##少了一个values报错
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”20’,’man’,’XUPT’)’ at line 1

MariaDB [linux]> insert into mn values (‘20’,’man’,’XUPT’); ##重新导入数据
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from mn;
+——+——+——–+
| age | sex | school |
+——+——+——–+
| 20 | man | XUPT |
+——+——+——–+
1 row in set (0.00 sec)

MariaDB [linux]>

修改数据库相关

alter table mn rename info; ##重命名表格mn为info
alter table mn add tele varchar(50) after sex; ##在表格里面添加tele信息并排在sex后面
update info set tele=’12345678’; ##更新tele里面的信息为123456(所有)
update info set tele=’1234151’ where username=’sarah’; ##更新sarah的tele信息为1234151


MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| mn |
+—————–+
1 row in set (0.00 sec)

MariaDB [linux]> alter table mn rename info;
Query OK, 0 rows affected (0.34 sec)

MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| info |
+—————–+
1 row in set (0.00 sec)

MariaDB [linux]> select * from info;
+——+——+——–+
| age | sex | school |
+——+——+——–+
| 20 | man | XUPT |
+——+——+——–+
1 row in set (0.00 sec)

MariaDB [linux]> alter table info add tele varchar(50) after sex;
Query OK, 1 row affected (0.39 sec)
Records: 1 Duplicates: 0 Warnings: 0

MariaDB [linux]> select * from info;
+——+——+——+——–+
| age | sex | tele | school |
+——+——+——+——–+
| 20 | man | NULL | XUPT |
+——+——+——+——–+
1 row in set (0.00 sec)

MariaDB [linux]> update info set tele=’12345678’;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [linux]> select * from info;
+——+——+———-+——–+
| age | sex | tele | school |
+——+——+———-+——–+
| 20 | man | 12345678 | XUPT |
+——+——+———-+——–+
1 row in set (0.00 sec)

MariaDB [linux]>

备份数据库相关

mysqldump -uroot -phubo –all-database >/mnt/database.qsl ##备份数据库所有的数据到指定目录的指定文件
mysqldump -uroot -phubo linux >/mnt/linux.sql ##备份linux数据库到指定目录指定文件
mysqldump -uroot -phubo –no-databases >/mnt/database.qsl ##只备份数据库的表格,不备份数据
mysql -uroot -phubo -e ‘create database linux;’ ##新建数据库linux
mysql -uroot -phubo linux < /mnt/linux.sql ##将备份的导入到新建的linux数据库里


[root@localhost ~]# mysqldump -uroot -phubo –all-database >/mnt/database.qsl ##备份数据库所有的数据到指定目录的指定文件
[root@localhost ~]# ls /mnt/
database.qsl linux.sql
[root@localhost ~]# vim /mnt/database.qsl
[root@localhost ~]# mysqldump -uroot -phubo linux >/mnt/linux.sql
[root@localhost ~]# ls /mnt/
database.qsl linux.sql
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> drop linux;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘linux’ at line 1
MariaDB [(none)]> drop database linux;
Query OK, 1 row affected (0.04 sec)

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]> create database linux; ##这一步可以直接在shell里完成(mysqldump -uroot -phubo -e ’ create database linux;’)
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| linux |
| mysql |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)

MariaDB [(none)]> Bye
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
Database changed
MariaDB [linux]> show tables;
Empty set (0.00 sec)

MariaDB [linux]> Bye
[root@localhost ~]# mysql -uroot -phubo linux < /mnt/linux.sql
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| info |
+—————–+
1 row in set (0.00 sec)

MariaDB [linux]> select * from info;
+——+——+———-+——–+
| age | sex | tele | school |
+——+——+———-+——–+
| 20 | man | 12345678 | XUPT |
+——+——+———-+——–+
1 row in set (0.00 sec)

MariaDB [linux]>

删除数据库相关

drop database linux; ##删除linux的数据库(包含里面的tables)
drop table info ; ##删除info表格
delate from info where age=’20’; ##删除info表格里age=20的数据
delate from info where age=’20’ and name=’peter’ ##删除info表格里age=20和name=peter的数据


[root@localhost ~]# mysql -uroot -phubo
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [linux]> select * from info;
+——+——+———-+——–+
| age | sex | tele | school |
+——+——+———-+——–+
| 20 | man | 12345678 | XUPT |
+——+——+———-+——–+
1 row in set (0.00 sec)

MariaDB [linux]> alter table info add name varchar(50);
Query OK, 1 row affected (0.45 sec)
Records: 1 Duplicates: 0 Warnings: 0

MariaDB [linux]> select * from info;
+——+——+———-+——–+——+
| age | sex | tele | school | name |
+——+——+———-+——–+——+
| 20 | man | 12345678 | XUPT | NULL |
+——+——+———-+——–+——+
1 row in set (0.00 sec)

MariaDB [linux]> insert into info values (”,”,”,”,’peter’);
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from info;
+——+——+———-+——–+——-+
| age | sex | tele | school | name |
+——+——+———-+——–+——-+
| 20 | man | 12345678 | XUPT | NULL |
| | | | | peter |
+——+——+———-+——–+——-+
2 rows in set (0.00 sec)

MariaDB [linux]> delete from info where name=’peter’;
Query OK, 1 row affected (0.04 sec)

MariaDB [linux]> select * from info;
+——+——+———-+——–+——+
| age | sex | tele | school | name |
+——+——+———-+——–+——+
| 20 | man | 12345678 | XUPT | NULL |
+——+——+———-+——–+——+
1 row in set (0.00 sec)

MariaDB [linux]> insert into info values (‘23’,’men’,’147258233’,’Normal University’,’peter’);
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from info;
+——+——+———–+——————-+——-+
| age | sex | tele | school | name |
+——+——+———–+——————-+——-+
| 20 | man | 12345678 | XUPT | NULL |
| 23 | men | 147258233 | Normal University | peter |
+——+——+———–+——————-+——-+
2 rows in set (0.00 sec)

MariaDB [linux]> delete from info where age=’20’;
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from info;
+——+——+———–+——————-+——-+
| age | sex | tele | school | name |
+——+——+———–+——————-+——-+
| 23 | men | 147258233 | Normal University | peter |
+——+——+———–+——————-+——-+

MariaDB [linux]> drop table info;
Query OK, 0 rows affected (0.34 sec)

MariaDB [linux]> show tables;
Empty set (0.00 sec)

MariaDB [linux]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| linux |
| mysql |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)

MariaDB [linux]> drop database linux;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]>

重置mysql root密码

systemctl stop mariadb ##停止数据库
mysqld_safe –skip-grant-tables & ##开启数据库不启动授权表
kill -9 进程号 ##结束数据库进程
mysql ->use mysql->update user set Password=password(‘redhat’) where User=’root’;[update user set Password=’redhat’ where User=’root’;这种设置是为加密的密码,密码会裸露出来,不安全,故采用第一种] ##进入数据路的操作
systemctl restart maiadb ##重启数据库


ot@localhost ~]# systemctl stop mariadb
[root@localhost ~]# ps -aux |grep mysql
root 3905 0.0 0.0 112640 976 pts/1 S+ 02:51 0:00 grep –color=auto mysql
[root@localhost ~]# mysqld_safe –skip-grant-tables &
[1] 3906
[root@localhost ~]# 170812 02:51:36 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
170812 02:51:36 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql ##这里会停住,按一下enter,让其继续运行

[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> update user set Password=password(‘westos’) where User=’root’;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

MariaDB [mysql]> Bye

[root@localhost ~]# ps -aux |grep mysql
root 3906 0.0 0.1 113256 1644 pts/1 S 02:51 0:00 /bin/sh /usr/bin/mysqld_safe –skip-grant-tables
mysql 4235 1.7 8.7 791148 88712 pts/1 Sl 02:54 0:00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –skip-grant-tables –log-error=/var/log/mariadb/mariadb.log –pid-file=/var/run/mariadb/mariadb.pid –socket=/var/lib/mysql/mysql.sock
root 4257 0.0 0.0 112640 980 pts/1 R+ 02:54 0:00 grep –color=auto mysql
[root@localhost ~]# kill -9 3906 ##关闭mysald_safe的进程
[root@localhost ~]# kill -9 4235 ##关闭mysald_safe的进程,先关闭第一个,再关闭第二个
[1]+ Killed mysqld_safe –skip-grant-tables
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
[root@localhost ~]# mysql -uroot -pwestos
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]>

创建用户和用户授权

CREATE USER lee@localhost identified by ‘lee’; ##创建本地用户lee并且密码为lee(by后面的为密码)
CREATE USER lee@’%’ identified by ‘lee’; ##创建本地和远程都可以登陆用户lee,密码lee
用户授权
GRANT INSERT,UPDATE,DELETE,SELECT,DROP on linux.* to lee@localhost; ##授予本地用户lee@localhost:导入….删除等权限在linux数据库上
重载授权表
FLUSH PRIVILEGES;
查看用户授权表
SHOW GRANTS FOR lee@localhost
撤销用户权限
REVOKE INSERT,UPDATE,DELETE,SELECT,DROP on westos.* from lee@localhost;
删除用户
DROP USER lee@localhost;


MariaDB [(none)]> create user lee@’%’ identified by ‘lee’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant insert,update,delate,drop,select on linux.* to lee@’%’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘delate,drop,select on linux.* to lee@’%” at line 1
(delete 打错了,报错)
MariaDB [(none)]> grant insert,update,delete,drop,select on linux.* to lee@’%’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants for lee@’%’;
+—————————————————————————————————-+
| Grants for lee@% |
+—————————————————————————————————-+
| GRANT USAGE ON . TO ‘lee’@’%’ IDENTIFIED BY PASSWORD ‘*9BB439A3A652A9DAD3718215F77A7AA06108A267’ |
| GRANT SELECT, INSERT, UPDATE, DELETE, DROP ON linux.* TO ‘lee’@’%’ |
+—————————————————————————————————-+
2 rows in set (0.00 sec)

MariaDB [(none)]> revoke UPDATE, DELETE on linux.* from lee@’%’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants for lee@’%’;
+—————————————————————————————————-+
| Grants for lee@% |
+—————————————————————————————————-+
| GRANT USAGE ON . TO ‘lee’@’%’ IDENTIFIED BY PASSWORD ‘*9BB439A3A652A9DAD3718215F77A7AA06108A267’ |
| GRANT SELECT, INSERT, DROP ON linux.* TO ‘lee’@’%’ |
+—————————————————————————————————-+
2 rows in set (0.00 sec)

MariaDB [(none)]> drop user lee@’%’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>

mysql图形化管理工具phpmysql

yum install mariadb httpd php php-mysql -y ##安装必要的软件
get /var/www/html/phpMyAdmin-3.4.0-all-languages.tar.bz2 ##下phpmyadmin软件包
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 ##解包
phpMyAdmin-3.4.0-all-languages ##解压得到的文件夹
mv phpMyAdmin-3.4.0-all-languages mariadbadmin ##重命名目录
less Documentation.txt ##查看安装说明
cp config.sample.inc.php config.inc.php ##按照说明重命名这个文件
vim config.inc.php
$cfg[‘blowfish_secret’]= ‘ba17clec07d65003’;
systemctl restart httpd
systemctl stop firewalld

测试
httpd://localhost/mysqladmin


[root@foundation23 Desktop]# tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 -C /var/www/html/
[root@foundation23 Desktop]# cd /var/www/html/
[root@foundation23 html]# ls
index.html ks1 phpmyadmin redhat7
ks ks.cfg phpMyAdmin-3.4.0-all-languages redhat72
[root@foundation23 html]# mv phpMyAdmin-3.4.0-all-languages/ mysqladmin
[root@foundation23 html]# ls
index.html ks ks1 ks.cfg mysqladmin redhat7 redhat72
[root@foundation23 html]# cd mysqladmin/
[root@foundation23 mysqladmin]# cp config.sample.inc.php config.inc.php
[root@foundation23 mysqladmin]# less Documentation.txt
[root@foundation23 mysqladmin]# vim config.inc.php
[root@foundation23 mysqladmin]# yum install php php-mysql -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
redhat72 | 4.1 kB 00:00
software | 2.9 kB 00:00
Package php-5.4.16-36.el7_1.x86_64 already installed and latest version
Package php-mysql-5.4.16-36.el7_1.x86_64 already installed and latest version
Nothing to do
[root@foundation23 mysqladmin]# systemctl restart httpd.service
[root@foundation23 mysqladmin]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)

Aug 12 15:35:55 foundation23.ilt.example.com systemd[1]: Stopped firewalld - …
Hint: Some lines were ellipsized, use -l to show in full.
[root@foundation23 mysqladmin]# systemctl restart mariadb.service
这里写图片描述
这里写图片描述
这里写图片描述

这篇关于RH134-第二十节-Mariadb数据库的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/545471

相关文章

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

MySQL数据库宕机,启动不起来,教你一招搞定!

作者介绍:老苏,10余年DBA工作运维经验,擅长Oracle、MySQL、PG、Mongodb数据库运维(如安装迁移,性能优化、故障应急处理等)公众号:老苏畅谈运维欢迎关注本人公众号,更多精彩与您分享。 MySQL数据库宕机,数据页损坏问题,启动不起来,该如何排查和解决,本文将为你说明具体的排查过程。 查看MySQL error日志 查看 MySQL error日志,排查哪个表(表空间

深入理解数据库的 4NF:多值依赖与消除数据异常

在数据库设计中, "范式" 是一个常常被提到的重要概念。许多初学者在学习数据库设计时,经常听到第一范式(1NF)、第二范式(2NF)、第三范式(3NF)以及 BCNF(Boyce-Codd范式)。这些范式都旨在通过消除数据冗余和异常来优化数据库结构。然而,当我们谈到 4NF(第四范式)时,事情变得更加复杂。本文将带你深入了解 多值依赖 和 4NF,帮助你在数据库设计中消除更高级别的异常。 什么是

DM8数据库安装后配置

1 前言 在上篇文章中,我们已经成功将库装好。在安装完成后,为了能够更好地满足应用需求和保障系统的安全稳定运行,通常需要进行一些基本的配置。下面是一些常见的配置项: 数据库服务注册:默认包含14个功能模块,将这些模块注册成服务后,可以更好的启动和管理这些功能;基本的实例参数配置:契合应用场景和发挥系统的最大性能;备份:有备无患;… 2 注册实例服务 注册了实例服务后,可以使用系统服务管理,

速了解MySQL 数据库不同存储引擎

快速了解MySQL 数据库不同存储引擎 MySQL 提供了多种存储引擎,每种存储引擎都有其特定的特性和适用场景。了解这些存储引擎的特性,有助于在设计数据库时做出合理的选择。以下是 MySQL 中几种常用存储引擎的详细介绍。 1. InnoDB 特点: 事务支持:InnoDB 是一个支持 ACID(原子性、一致性、隔离性、持久性)事务的存储引擎。行级锁:使用行级锁来提高并发性,减少锁竞争

开源分布式数据库中间件

转自:https://www.csdn.net/article/2015-07-16/2825228 MyCat:开源分布式数据库中间件 为什么需要MyCat? 虽然云计算时代,传统数据库存在着先天性的弊端,但是NoSQL数据库又无法将其替代。如果传统数据易于扩展,可切分,就可以避免单机(单库)的性能缺陷。 MyCat的目标就是:低成本地将现有的单机数据库和应用平滑迁移到“云”端

ORACLE 11g 创建数据库时 Enterprise Manager配置失败的解决办法 无法打开OEM的解决办法

在win7 64位系统下安装oracle11g,在使用Database configuration Assistant创建数据库时,在创建到85%的时候报错,错误如下: 解决办法: 在listener.ora中增加对BlueAeri-PC或ip地址的侦听,具体步骤如下: 1.启动Net Manager,在“监听程序”--Listener下添加一个地址,主机名写计

MyBatis 切换不同的类型数据库方案

下属案例例当前结合SpringBoot 配置进行讲解。 背景: 实现一个工程里面在部署阶段支持切换不同类型数据库支持。 方案一 数据源配置 关键代码(是什么数据库,该怎么配就怎么配) spring:datasource:name: test# 使用druid数据源type: com.alibaba.druid.pool.DruidDataSource# @需要修改 数据库连接及驱动u

CentOS下mysql数据库data目录迁移

https://my.oschina.net/u/873762/blog/180388        公司新上线一个资讯网站,独立主机,raid5,lamp架构。由于资讯网是面向小行业,初步估计一两年内访问量压力不大,故,在做服务器系统搭建的时候,只是简单分出一个独立的data区作为数据库和网站程序的专区,其他按照linux的默认分区。apache,mysql,php均使用yum安装(也尝试

Java基础回顾系列-第九天-数据库编程

Java基础回顾系列-第九天-数据库编程 数据库简介工具包java.sql API 内容与数据库建立连接执行SQL语句数据库检索和更新查询结果SQL类型对应Java类型映射元数据异常 API方法DriverManagerConnectionStatementPreparedStatementCallableStatementResultSetjava.sql.Date批处理、存储过程、事务