在Windows上为网站设置mySQL数据库和TomCat

时间:2015-04-18 00:55:35

标签: mysql

我一直在各地搜索,我无法围绕设置服务器的过程,并在网站上使用一些模式。

我正在使用workbench,但也使用命令行方式。

我有两台台式电脑。我想要正常使用的一个。第二个被设置为mySQL数据库,就是这样。这里需要的是数据库PC应该允许某种远程访问,以便我的网站可以连接到它。

1 个答案:

答案 0 :(得分:0)

在Windows中安装MySQL服务器很简单,但首次访问有一些小技巧。首先从这里下载MySQL服务器:

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

在安装过程中,不要忘记检查将MySQL添加到系统路径变量的选项。

之后,您将不得不重置root密码。出于某种奇怪的原因,root密码不起作用(至少在Windows上)。按照此处的说明操作:

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

缩短时间:

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

要测试您的登录信息,请使用DOS提示符并键入

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