MacOS 12.3 上的 MySQL Workbench 8.0.28 导出问题

发布于 2025-01-18 03:36:41 字数 1549 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深如许 2025-01-25 03:36:41

导出MySQL或Mariadb数据库

从控制台使用MySQLDUMP命令 以导出数据库。备份完成后,可以轻松移动生成的文件。要开始导出数据库,您必须执行以下操作:

mysqldump -u username -p database_name > data-dump.sql
  • 用户名:是指数据库用户的名称。

  • database_name:必须用要导出的数据库的名称代替。

  • data-dump.sql:是将使用所有数据库信息生成的文件。

该命令不会产生任何视觉输出。因此,为确保已正确执行SQL副本,您可以检查生成的文件以确保其是SQL副本。为此,您可以使用以下语句:

head -n 5 data-dump.sql

该命令应返回这样的内容:

-- MySQL dump 10.13  Distrib 5.7.16, for Linux (x86_64)
--
-- Host: localhost    Database: database_name
-- ------------------------------------------------------
-- Server version       5.7.16-0 ubuntu 0.16.04.1

也可以导出一个或多个表而不是整个数据库。为此,您必须在命令中指示要进行的选择。

mysqldump -u username -p database_name table_name_1 table_name_2 table_name_3 > data-dump.sql

在这种情况下,重要的是要特别注意不同记录之间的关系。导入时,只有那些已选择的表将被覆盖。

导入MySQL或Mariadb数据库

以导入MySQL或Mariadb转储,首先要做的就是创建将要进行导入的数据库。为此,如果您没有任何数据库管理器,则必须将数据库服务器作为“ root”用户连接。

mysql -u root –p

这将打开MySQL或MariaDB外壳。然后,您将能够创建数据库。

mysql> CREATE DATABASE new_database;

如果一切顺利,您会看到这样的东西:

Query OK, 1 row affected (0.00 sec)

创建后,您必须通过按CTRL+D来退出此外壳。一旦进入普通命令行,就该启动将执行数据库导入的命令了。

mysql -u username -p new_database < data-dump.sql
  • 用户名:是使用数据库的用户名称。

  • new_database:是将执行导入的数据库的名称。

  • data-dump.sql:是包含所有要导入的SQL语句的文件的名称。

如果导入过程中发生任何错误,则将显示在屏幕上。如您所见,导出和导入MySQL或MariadB数据库是一个非常简单的过程。

注意:所有这些都是用ubuntu在终端中完成的,但在Mac中是完全相同的。

另一个解决方案:,如果您仍然会遇到该错误,我发现您认为您正在使用OpenSSL而不是YSSSL。

请参阅MySQL配置变量SSL_CIPHER。 a>

配置一个密码列表,包括伪加密@seclevel = 1

例如:

ssl_cipher = "DHE-RSA-AES128-GCM-SHA256:AES128-SHA:@SECLEVEL=1"

如果您需要更宽松但仍然安全的加密列表。

"EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:@SECLEVEL=1"

取自 https://cipherlist.eu/ 可以完成这项工作。

Exporting a MySQL or MariaDB database

To export the database, the mysqldump command is used from the console. Once the backup is done, the generated file can be easily moved. To start exporting the database you have to execute the following:

mysqldump -u username -p database_name > data-dump.sql
  • username : Refers to the name of the database user.

  • database_name : Must be replaced by the name of the database you want to export.

  • data-dump.sql : Is the file that will be generated with all the database information.

That command will not produce any visual output. So, to make sure that the SQL copy has been performed correctly, you can inspect the generated file to make sure that it is a SQL copy. To do this you can use the following statement:

head -n 5 data-dump.sql

That command should return something like this:

-- MySQL dump 10.13  Distrib 5.7.16, for Linux (x86_64)
--
-- Host: localhost    Database: database_name
-- ------------------------------------------------------
-- Server version       5.7.16-0 ubuntu 0.16.04.1

It is also possible to export one or more tables instead of the entire database. To do this, you must indicate in the command the selection you want to make.

mysqldump -u username -p database_name table_name_1 table_name_2 table_name_3 > data-dump.sql

In this case, it is important to take special care with the relationships between the different records. When importing, only those tables that have been selected will be overwritten.

Importing a MySQL or MariaDB database

To import a MySQL or MariaDB dump, the first thing to do is to create the database into which the import will be done. To do this, if you do not have any database manager, you have to connect to the database server as "root" user.

mysql -u root –p

This will open the MySQL or MariaDB shell. You will then be able to create the database.

mysql> CREATE DATABASE new_database;

If everything went well, you will see something like this:

Query OK, 1 row affected (0.00 sec)

Once created, you have to exit this shell by pressing CTRL+D. Once you are in the normal command line, it will be time to launch the command that will perform the database import.

mysql -u username -p new_database < data-dump.sql
  • username : Is the name of the user with access to the database.

  • new_database : Is the name of the database where the import will be performed.

  • data-dump.sql : Is the name of the file containing all the sql statements to be imported.

If any errors occur during the import process, they will be displayed on the screen. As you can see, exporting and importing a MySQL or MariaDB database is a very simple process.

Note : All this is done with Ubuntu in a terminal but in MAC it is exactly the same .

Another solution : In case you still get that error I have found assuming you are using OpenSSL and not ysSSL.

Refer to the MySQL configuration variable ssl_cipher. ssl_cipher

Configure a list of ciphers including pseudo-encryption @SECLEVEL=1

For example :

ssl_cipher = "DHE-RSA-AES128-GCM-SHA256:AES128-SHA:@SECLEVEL=1"

If you need a more permissive but still secure encryption list.

"EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:@SECLEVEL=1"

taken from https://cipherlist.eu/ could do the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文