MySql教程

新建本地mysql连接

本文主要是介绍新建本地mysql连接,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

新建本地mysql连接
1.删空data文件夹。(如果是再次安装的话)
在这里插入图片描述
2.在bin目录下加my.ini文件
在这里插入图片描述
[client]

port=3306

[mysql]

default-character-set=utf8

[mysqld]

port=3306

basedir=“D:\SoftWare\MYSQL\mysql\mysql-5.7.19-winx64”

datadir=“D:\SoftWare\MYSQL\mysql\mysql-5.7.19-winx64\data”

character-set-server=utf8

[WinMySQLadmin]

Server=“D:\SoftWare\MYSQL\mysql\mysql-5.7.19-winx64\bin\mysqld.exe”

default-character-set=utf8

default-storage-engine=INNODB

sql-mode=“STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

max_connections=100

query_cache_size=0

table_cache=256

tmp_table_size=26M

thread_cache_size=8

myisam_max_sort_file_size=100G

myisam_sort_buffer_size=52M

key_buffer_size=40M

read_buffer_size=64K

read_rnd_buffer_size=256K

sort_buffer_size=256K

Use this option if you have a MySQL server withInnoDB support enabled

but you do not plan to use it. This will save memoryand disk space

and speed up some things.

#skip-innodb

Additional memory pool that is used by InnoDB tostore metadata

information. If InnoDB requires more memory for this purpose it will

start to allocate it from the OS. As this is fast enough on most

recent operating systems, you normally do not needto change this

value. SHOW INNODB STATUS will display the currentamount used.

innodb_additional_mem_pool_size=2M

innodb_flush_log_at_trx_commit=1

innodb_log_buffer_size=1M

innodb_buffer_pool_size=77M

innodb_log_file_size=39M

innodb_thread_concurrency=8

3.打开cmd(管理员权限),进到%path%bin目录下,输入命令 msyqld --initialize --console
在这里插入图片描述

4.然后输入 mysqld install .然后启动服务器 net start mysql
在这里插入图片描述
5.添加一个root用户。然后更密码。
mysql -u root -p
set password for root@localhost = password(‘123456’);
在这里插入图片描述
mysql服务可以启动啦!

6.先新建一个数据库
mysql> SHOW DATABASES;
mysql> CREATE DATABASE 库名;

7.在dbeaver新建连接
库名为刚刚建的库名
在这里插入图片描述

8.设置驱动属性在这里插入图片描述

(JDBC:The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more than one time zone.)
DBEAVER/IDEA设置
无论是什么工具或者IDE,中心思想都是增加一个serverTimezone的驱动属性,value= Asia/Shanghai

9.测试连接,成功!

这篇关于新建本地mysql连接的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!