Install and uninstall the database (MySQL)

Installing MySQL

1. Open the downloaded file to install mysql double-click unzip, run "mysql-5.5.40-win64.msi". Here are 64

2. Select the type of installation, there is "Typical (default)", "Complete (full)", "Custom (user-defined)," the three options, select "Custom", press "next" to continue.

3. Click "Browse", to manually specify the installation directory. 

4. Insert the installation directory, I was "d: \ Program Files (x86) \ MySQL \ MySQL Server 5.0", press "OK" to continue.

5. confirm previous settings, if there are errors, press "Back" to return to redo. Press "Install" to begin the installation.

6. being installed, please wait until the following screen appears, the installation is completed MYSQL


Installed the database needs to be configured to use MYSQL database configuration

7. When the installation is complete, the following interface will enter the mysql configuration wizard.

8. Select configuration, "Detailed Configuration (manual precise configuration)", "Standard Configuration (standard)", we choose "Detailed Configuration", familiar to facilitate the configuration process.

9. Select the server type, "Developer Machine (developing test class, mysql occupy very little resources)", "Server Machine (server type, mysql occupy more resources)", "Dedicated MySQL Server Machine (dedicated database server, mysql occupy All available resources). "

10. The use of a substantially selected mysql database, "Multifunctional Database (Universal multi-function type, good)", "Transactional Database Only (server type, focused on transaction processing, general)", "Non-Transactional Database Only (non-transaction processing , relatively simple, mainly to do some monitoring, counting with support for MyISAM data type is limited to non-transactional), press "Next" to continue.

11.选择网站并发连接数,同时连接的数目,“Decision Support(DSS)/OLAP(20个左右)”、“Online Transaction Processing(OLTP)(500个左右)”、“Manual Setting(手动设置,自己输一个数)”

12.是否启用TCP/IP连接,设定端口,如果不启用,就只能在自己的机器上访问mysql数据库了,在这个页面上,您还可以选择“启用标准模式”(Enable Strict Mode),这样MySQL就不会允许细小的语法错误。如果是新手,建议您取消标准模式以减少麻烦。但熟悉MySQL以后,尽量使用标准模式,因为它可以降低有害数据进入数据库的可能性。按“Next”继续

13.就是对mysql默认数据库语言编码进行设置(重要),一般选UTF-8,按 “Next”继续。

14.选择是否将mysql安装为windows服务,还可以指定Service Name(服务标识名称),是否将mysql的bin目录加入到Windows PATH(加入后,就可以直接使用bin下的文件,而不用指出目录名,比如连接,“mysql.exe -uusername -ppassword;”就可以了,不用指出mysql.exe的完整地址,很方便),我这里全部打上了勾,Service Name不变。按“Next”继续。

15.询问是否要修改默认root用户(超级管理)的密码。“Enable root access from remote machines(是否允许root用户在其它的机器上登陆,如果要安全,就不要勾上,如果要方便,就勾上它)”。最后“Create An Anonymous Account(新建一个匿名用户,匿名用户可以连接数据库,不能操作数据,包括查询)”,一般就不用勾了,设置完毕,按“Next”继续。

16.确认设置无误,按“Execute”使设置生效,即完成MYSQL的安装和配置。

注意:设置完毕,按“Finish”后有一个比较常见的错误,就是不能“Start service”,一般出现在以前有安装mysql的服务器上,解决的办法,先保证以前安装的mysql服务器彻底卸载掉了;不行的话,检查是否按上面一步所说,之前的密码是否有修改,照上面的操作;如果依然不行,将mysql安装目录下的data文件夹备份,然后删除,在安装完成后,将安装生成的 data文件夹删除,备份的data文件夹移回来,再重启mysql服务就可以了,这种情况下,可能需要将数据库检查一下,然后修复一次,防止数据出错。

解决方法:卸载MySQL,重装MySQL

 

数据库的卸载

1.停止window的MySQL服务。 找到“控制面板”-> “管理工具”-> “服务”,停止MySQL后台服务。

2.卸载MySQL安装程序。找到“控制面板”-> "程序和功能",卸载MySQL程序。

3.删除MySQL安装目录下的所有文件。

4.删除c盘ProgramDate目录中关于MySQL的目录。路径为:C:\ProgramData\MySQL(是隐藏文件,需要显示出来)

数据库服务的启动与登录

MySQL服务器启动方式有两种:
1)通过服务的方式自动启动
2)手动启动的方式

1. Windows服务方式启动

2 .DOS命令方式启动

控制台连接数据库

MySQL是一个需要账户名密码登录的数据库,登陆后使用,它提供了一个默认的root账号,使用安装时设置的密码即可登录

  • 登录格式1:u和p后面没有空格
mysql -u用户名 -p密码

后输入密码方式:

  • 登录格式2:
mysql -hip地址 -u用户名 -p密码

127.0.0.1 代表本机的IP地址

  • 登录格式3:
mysql --host=ip地址 --user=用户名 --password=密码

  • 退出MySQL:
quit或exit

 

发布了91 篇原创文章 · 获赞 16 · 访问量 1212

Guess you like

Origin blog.csdn.net/hewenqing1/article/details/103774930