安装Mysql-Front后如何设置登录信息?

安装Mysql-Front后如何设置登录信息?,第1张

服务器:127.0.0.1或者localhost。

如果输入的MYSQL数据库的IP、用户名、密码、数据库都正确后,就可以打开服务器了,然后通过“视图”->“SQL编辑器”将MYSQL的查询语句复制到SQL编辑器中,便可以迅速的将MYSQL数据库导入了。

MYSQL管理器的“对象浏览器”、“数据浏览器”可方便的建立、修改数据库表的结构及数据。

除了服务器外,其它登录信息是可以随便填写的,不影响使用。

例如:在信息选项下名称处填写“localhost”,在注册选项下面填写密码“123456”(安装MySQL时的密码),在连接选项下服务器处输入“127.0.0.1”,字符集选择“utf8”。

1、使用 create table 语句可完成对表的创建, create table 的创建形式:

create table 表名称(列声明)

以创建 people 表为例, 表中将存放 学号(id)、姓名(name)、性别(sex)、年龄(age) 这些内容:

create table people(

id int unsigned not null auto_increment primary key,

name char(8) not null,

sex char(4) not null,

age tinyint unsigned not null

)

其中,auto_increment就可以使Int类型的id字段每次自增1。

2、向表中插入数据使用insert 语句。

insert 语句可以用来将一行或多行数据插到数据库表中, 使用的一般形式如下:

insert [into] 表名 [(列名1, 列名2, 列名3, ...)] values (值1, 值2, 值3, ...)

其中 [] 内的内容是可选的, 例如, 要给上步中创建的people 表插入一条记录, 执行语句:

insert into people(name,sex,age) values( "张三", "男", 21 )

3、想要查询是否插入成功,可以通过select 查询语句。形式如下:

select * from people;

扩展资料:

当mysql大批量插入数据的时候使用insert into就会变的非常慢, mysql提高insert into 插入速度的方法有三种:

1、第一种插入提速方法:

如果数据库中的数据已经很多(几百万条), 那么可以 加大mysql配置中的 bulk_insert_buffer_size,这个参数默认为8M

举例:bulk_insert_buffer_size=100M;

2、第二种mysql插入提速方法:

改写所有 insert into 语句为 insert delayed into

这个insert delayed不同之处在于:立即返回结果,后台进行处理插入。

3、第三个方法: 一次插入多条数据:

insert中插入多条数据,举例:

insert into table values('11','11'),('22','22'),('33','33')...

DELIMITER $$

CREATE FUNCTION insert_pic(r_count int,r_value varchar(30)) RETURNS int

begin

while r_count>0 do

insert into xgz (pic) values (r_value )

set r_count=count-1

end while

return row_count()

end

$$

DELIMITER

执行之后以后就用 select insert_pic(100,'pic/kong.gif')就可以插入100条了

另外如果你有一个表t,这个表的数据条数(row count)是你想要插入的数量,那么一句话:

insert into xgz (pic) (select 'pic/kong.gif' from t)

Enter password: ********

Welcome to the MySQL monitor. Commands end with or \g.

Your MySQL connection id is 23

Server version: 5.1.26-rc-community MySQL Community Server (GPL)

Type 'help' or '\h' for help. Type '\c' to clear the buffer.

mysql>use db5

Database changed

mysql>DELIMITER $$

mysql>CREATE FUNCTION insert_pic(r_count int,r_value varchar(30)) RETURNS int

->begin

->while r_count>0 do

->insert into xgz (pic) values (r_value )

->set r_count=count-1

->end while

->return row_count()

->end

->

->$$

Query OK, 0 rows affected (0.05 sec)

mysql>

mysql>DELIMITER

mysql>select insert_pic(100,'pic/kong.gif')

Enter password: ********

Welcome to the MySQL monitor. Commands end with or \g.

Your MySQL connection id is 24

Server version: 5.1.26-rc-community MySQL Community Server (GPL)

Type 'help' or '\h' for help. Type '\c' to clear the buffer.

mysql>use db5

Database changed

mysql>insert into xgz (pic) (select 'pic/kong.gif' from t)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11837034.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存