简体   繁体   English

在Windows上为网站设置mySQL db和TomCat

[英]Setting up mySQL db and TomCat on Windows for a website

I've been searching everywhere, and I just can't wrap my head around the procedure that lies in setting a server up with some schemas to be used along a website. 我到处都在搜索,只是无法确定程序来设置服务器并在网站上使用一些模式。

I'm using workbench, but also the command line way. 我正在使用工作台,但也在使用命令行方式。

I have two desktop computers. 我有两台台式计算机。 One that I want for normal use. 我想要正常使用的一种。 And the second to be put up as a mySQL database, and just that. 第二个将作为mySQL数据库建立,仅此而已。 The need here is that the database PC, should allow some kind of remote access, so that my website may connect to it. 这里的需要是数据库PC应该允许某种远程访问,以便我的网站可以连接到它。

Installing MySQL Server in windows is easy, however first access have a small tricks. 在Windows中安装MySQL Server很容易,但是先入为主。 Start by downloading MySQL Server from here: 首先从这里下载MySQL Server:

http://dev.mysql.com/downloads/mysql/ http://dev.mysql.com/downloads/mysql/

During the install don't forget to check the options to add MySQL to the System Path Variables. 在安装过程中,请不要忘记检查将MySQL添加到系统路径变量的选项。

After that you'll have to reset the root password. 在那之后,您将不得不重置根密码。 For some weird reason the root password doesn't work (at least on windows). 由于某些奇怪的原因,root密码不起作用(至少在Windows上)。 Follow the instructions here: 请按照以下说明进行操作:

http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

To make it shorter: 使其更短:

1) Type services.msc in start menu to open the service lists
2) Stop MySQL server
3) Create a txt file with the content below, placing the commands in 2 lines.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
4) Execute this command on a DOS prompt
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld.exe" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\\my.ini" --init-file=C:\\arquivo.txt --console
The init-file must point to the file created in item (3)
5) Delete the file created, restart MySQL service and logon normally with root user

To test your login, use a DOS prompt and type 要测试您的登录名,请使用DOS提示符并键入

mysql -h 127.0.0.1 -u root -pMyNewPass (no spaces between "P" and your password).

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM