建立本地数据库

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xuxiatian/article/details/80336373

首先下载安装MySQL,参考:http://www.runoob.com/mysql/mysql-install.html,安装完成后直接打开(安装过程中要求设置用户名和密码,此时输入的密码要记住,后面要使用)


然后下载Navicat for MySQL,本人觉得这个比较简单,很适合初学者,安装完成之后点击File(文件)--新建文件,连接名可不填,主机名:localhost,用户名是安装MySQL的时候设置的,密码同样是上面设置的密码,填写好之后点击测试连接,此时会显示连接成功,点击确定,就可以在本地基础上建立数据库。


因为之前没有接触过MySQL,一直以为Navicat就是数据库,所以就直接连接本地数据库,怎么都连接不上,原来是要安装数据库


所遇问题及解决方法:

1. 安装错误:丢失VCRUNTIME140,下载并安装VC++2015,https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=48145

2. mysql服务无法启动:创建文件my.ini,编辑其内容如下:

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\Program Files\mysql-8.0.11-winx64\setup
# 设置mysql数据库的数据的存放目录
D:\Program Files\mysql-8.0.11-winx64\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎

default-storage-engine=INNODB

将该文件放到bin目录下,如:D:\Program Files\mysql-8.0.11-winx64\bin

执行命令:

D:\Program Files\mysql-8.0.11-winx64\bin>mysqld --initialize-insecure
D:\Program Files\mysql-8.0.11-winx64\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。

3. 安装启动成功后,可以重新设置密码,否则默认的用户名是root,密码为空。使用命令mysql -u root -p出现输入密码,因为默认密码为空,所以直接按回车键,就可以进入mysql界面。此时可以设置新密码。


4. 使用navicat与mysql建立连接时失败,原因是不接受密码为空,因此要修改root密码。修改方法如下:

(1)用mysqladmin

(2)修改MySQL的root用户密码格式:mysqladmin -u用户名 -p旧密码 password 新密码

      例子:mysqladmin -uroot -pshapolang password 123456

上面例子将用户root原来的密码shapolang改为新密码123456
重新登录,输入新密码123456就ok了;


本地数据库建立问题!!

04-23

rn在sybase central 4.1 中创建数据库。按提示一步一步做的时候,最后点 finish rn却提示 unable to start datebase rn下面是给出的错误方面。。我不知道哪儿错了 rn我是按书一步一步的呀。。我用的 是 win me 的操作系统。和这有关吗。一定要用2win2000 ????rn在线等候。。谢谢rn +-----------------+rnrn | Stack Trace |rnrn +-----------------+rnrnrnrnCurrent thread: AWT-EventQueue-0rnrnjava.lang.NullPointerExceptionrnrn at com.sybase.asiq.plugin.CreateDatabaseWizard.deploy(CreateDatabaseWizard.java:138)rnrn at com.sybase.asa.ASABaseWizardDialogController.onWizardFinish(ASABaseWizardDialogController.java:37)rnrn at com.sybase.central.viewer.ScjWizardDialog.onWizardFinish(ScjWizardDialog.java)rnrn at com.sybase.central.viewer.ScjWizardDialog.actionPerformed(ScjWizardDialog.java)rnrn at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)rnrn at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)rnrn at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)rnrn at javax.swing.DefaultButtonModel.setPressed(Unknown Source)rnrn at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)rnrn at java.awt.Component.processMouseEvent(Unknown Source)rnrn at java.awt.Component.processEvent(Unknown Source)rnrn at java.awt.Container.processEvent(Unknown Source)rnrn at java.awt.Component.dispatchEventImpl(Unknown Source)rnrn at java.awt.Container.dispatchEventImpl(Unknown Source)rnrn at java.awt.Component.dispatchEvent(Unknown Source)rnrn at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)rnrn at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)rnrn at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)rnrn at java.awt.Container.dispatchEventImpl(Unknown Source)rnrn at java.awt.Window.dispatchEventImpl(Unknown Source)rnrn at java.awt.Component.dispatchEvent(Unknown Source)rnrn at java.awt.EventQueue.dispatchEvent(Unknown Source)rnrn at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)rnrn at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)rnrn at java.awt.Dialog.show(Unknown Source)rnrn at java.awt.Component.show(Unknown Source)rnrn at java.awt.Component.setVisible(Unknown Source)rnrn at com.sybase.central.viewer.ScjBaseDialog.showDialog(ScjBaseDialog.java)rnrn at com.sybase.central.viewer.ScjWizardDialog.render(ScjWizardDialog.java)rnrn at com.sybase.central.viewer.ScjDialogSupport.render(ScjDialogSupport.java)rnrn at com.sybase.asiq.plugin.CreateDatabaseWizard.showDialog(CreateDatabaseWizard.java:124)rnrn at com.sybase.asiq.plugin.UtilitySetBO.startUtility(UtilitySetBO.java:72)rnrn at com.sybase.asiq.plugin.UtilitySetBO.onCommand(UtilitySetBO.java:298)rnrn at com.sybase.asiq.plugin.ASAActionItem.onCommand(ASAActionItem.java:61)rnrn at com.sybase.central.viewer.ViewerManager.callOnCommandForItems(ViewerManager.java)rnrn at com.sybase.central.viewer.ViewerManager.menuItemSelected(ViewerManager.java)rnrn at com.sybase.central.viewer.BaseMenuItem.actionPerformed(BaseMenuItem.java)rnrn at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)rnrn at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)rnrn at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)rnrn at javax.swing.DefaultButtonModel.setPressed(Unknown Source)rnrn at javax.swing.AbstractButton.doClick(Unknown Source)rnrn at com.sybase.util.WindowsMenuItemUI$MouseInputHandler.mouseReleased(WindowsMenuItemUI.java)rnrn at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)rnrn at java.awt.Component.processMouseEvent(Unknown Source)rnrn at java.awt.Component.processEvent(Unknown Source)rnrn at java.awt.Container.processEvent(Unknown Source)rnrn at java.awt.Component.dispatchEventImpl(Unknown Source)rnrn at java.awt.Container.dispatchEventImpl(Unknown Source)rnrn at java.awt.Component.dispatchEvent(Unknown Source)rnrn at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)rnrn at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)rnrn at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)rnrn at java.awt.Container.dispatchEventImpl(Unknown Source)rnrn at java.awt.Window.dispatchEventImpl(Unknown Source)rnrn at java.awt.Component.dispatchEvent(Unknown Source)rnrn at java.awt.EventQueue.dispatchEvent(Unknown Source)rnrn at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)rnrn at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)rnrn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rnrn at java.awt.EventDispatchThread.run(Unknown Source)rnrnrnrnrnrnrnrn +--------------------+rnrn | Sybase Central |rnrn +--------------------+rnrnrnrnVersion: 4.1.1.1346rnrnrnrnrnrn +-------------+rnrn | Java VM |rnrn +-------------+rnrnrnrnTotal memory: 11038720rnrnFree memory: 1527808rnrnSystem properties:rnrn awt.toolkit=sun.awt.windows.WToolkitrnrn file.encoding=GBKrnrn file.encoding.pkg=sun.iornrn file.separator=\rnrn java.awt.fonts=rnrn java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironmentrnrn java.awt.printerjob=sun.awt.windows.WPrinterJobrnrn java.class.path=C:\PROGRA~1\SYBASE\SHARED\SYBASE~1.1\SYBASE~1.JAR;C:\PROGRA~1\SYBASE\SHARED\JAVA\JSYBLI~1.JAR;C:\PROGRA~1\SYBASE\SHARED\JAVA\HELPMA~1.JAR;C:\PROGRA~1\SYBASE\SHARED\JAVA\SCEDIT~1.JAR;C:\PROGRA~1\SYBASE\SHARED\SUN\JAVAHE~1\JH.JAR;C:\PROGRA~1\SYBASE\SHARED\SYBASE~1.1\JCCHAR~1.JAR;C:\PROGRA~1\SYBASE\SQLANY~1\JAVA\JLOGON.JAR;C:\PROGRA~1\SYBASE\SHARED\JCONNE~2\CLASSES\JCONN2.JAR;rnrn java.class.version=47.0rnrn java.ext.dirs=C:\PROGRAM FILES\SYBASE\SHARED\SUN\JRE131\lib\extrnrn java.home=C:\PROGRAM FILES\SYBASE\SHARED\SUN\JRE131rnrn java.io.tmpdir=C:\WINDOWS\TEMP\rnrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试