mysql默认的SID是多少?

mysql默认的SID是多少?,第1张

mysql没有SID之说,安装完mysql之后,你启动数据库,之后再你的数据文件目录会生成一个”.pid“的文件,和一个".sock"的文件,前一个是mysql的进程ID号,后一个是一个sock的套接字文件。

这样:

jdbc:mysql://<hostname>[<:3306>]/<dbname>

jdbc:mysql://localhost:3306/db_librarySys

Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/db_librarySys?user=root&password=1234")

Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/db_librarySys", "root", "1234")

扩展资料:

注意事项

URL=协议名+子协议名+数据源名。

1、协议名总是“jdbc”。

2、子协议名由JDBC驱动程序的编写者决定。

3、数据源名也可能包含用户与口令等信息;这些信息也可单独提供。

URL:jdbc:oracle:thin:@machine_name:port:dbname

注:machine_name:数据库所在的机器的名称;

port:端口号,默认是1521

Class.forName("oracle.jdbc.driver.OracleDriver").newInstance()

String url="jdbc:oracle:thin:@localhost:1521:orcl"

//orcl为数据库的SID

String user="test"

String password="test"

Connection conn= DriverManager.getConnection(url,user,password)

注意:Oracle的URL有两种写法:

1、jdbc:oracle:thin:@localhost:1521:databaseName   常用 *** 作sql的工具:sqlDeveloper.exe,还可以用其他数据库,如mysql等

2、jdbc:oracle:oci:@localhost:1521:databaseName    用来 *** 作SQL的工具只能用:PL/SQL Developer;数据库集群时候常用此连接,比上面那个多点功能,性能好点。

查询MySQL数据库所有表名的SQL命令:

show tables

查询MySQL数据库有表结构的SQL命令:

show create table tblName

例如:show create table students

CREATE TABLE `students` (

`sid` char(10) NOT NULL,

`sname` varchar(50) NOT NULL,

`sex` char(1) NOT NULL,

`dob` date NOT NULL,

`phone` varchar(30) DEFAULT NULL,

PRIMARY KEY (`sid`),

KEY `index_tbl1_url` (`phone`(20))

) ENGINE=InnoDB DEFAULT CHARSET=gb2312


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

原文地址: https://www.outofmemory.cn/sjk/6848743.html

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

发表评论

登录后才能评论

评论列表(0条)

保存