Mysql 超级快速入门

安装之后。进入命令行

mysql -uroot 

默认密码是空的,所以不需要写。

有密码登录:

mysql -uroot -pxxxxx 

修改密码:

mysqladmin -uroot password xxxxx

已经有密码之后,再修改

mysqladmin -uroot -pxxxxx password yyyyyy

显示数据库

show databases;

use test; 

show tables;

使用myeclipse database driver链接数据库:

drivername = 随便

connection url : jdbc:mysql://localhost:3306/biz?user=root&password=123456

username:root

password: 123456

driver jars =  mysql-connector-java-5.1.13.jar

driver classname =  com.mysql.jdbc.Driver

启动hibernate出现错误:

 警告: Could not obtain connection metadata

java.sql.SQLException: null,  message from server: "Host '1455863CAF9F409' is not allowed to connect to this MySQL server"

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)

原因:

http://topic.csdn.net/u/20070529/11/7a7da552-1370-4834-aaf3-2b5f8dd25912.html

你使用的连接用户id没有权限连接到你的host上去阿。查一下你的用户找好啊,看看这个用户是不市被限定只能在你的host上面了阿,如果用的是root的话,默认情况下root只能在localhost上使用。 

让hibernate自动建表:

在配置文件配置:<prop key="hibernate.hbm2ddl.auto">create</prop>

hibernate-daos.xml 

原文地址:https://www.cnblogs.com/zc22/p/1765867.html