简体   繁体   English

解决Bitnami MySQL连接问题

[英]Resolving Bitnami MySQL Connectivity Issues

I have setup Bitnami MySQL service on Azure. 我已经在Azure上安装了Bitnami MySQL服务。 The VM is up and I am able to connect to the VM through ssh like ssh username@HOSTNAME: VM已启动,我可以通过ssh像ssh username @ HOSTNAME一样连接到VM:

I am able to login to the mysql from the prompt like 我能够从提示符登录到mysql

mysql -uroot -pSOMEPASS > mysql -uroot -pSOMEPASS>

Meanwhile I am able to connect this mysql service from a remote host: mysql -uroot -pPASS -hxxx.xxx.xx.xx 同时,我能够从远程主机连接此mysql服务:mysql -uroot -pPASS -hxxx.xxx.xx.xx

The following error is what I received 以下错误是我收到的

ERROr 2003 (HY000); ERROr 2003(HY000); Can't connect to MySQL Server on xxx.xxx.xx.xx 无法连接到xxx.xxx.xx.xx上的MySQL Server

I tried commenting out the the bind-address in the /opt/bitnami/mysql/my.cnf 我试图注释掉/opt/bitnami/mysql/my.cnf中的bind-address

and tried giving the value for bind-address as 0:0:0:0 & also removing the variable. 并尝试将bind-address的值设置为0:0:0:0并删除该变量。

To ensure the mysql port is up or not I gave the following comamnd 为了确保mysql端口是否启动,我给出了以下命令

netstat -tln netstat -tln

tcp6 0 0 :::3306 :::* LISTEN tcp6 0 0 ::: 3306 ::: *听

the above results mean port is and listening 上面的结果表示端口在监听

In terms of file permission related, I entered the following ones 关于文件权限,我输入了以下内容

chmod 777 /opt/bitnami/mysql/tmp chmod 755 /opt/bitnami/mysql/data chown -R root:root /opt/bitnami/mysq/tmp chown mysql:root /opt/bitnami/mysql/data/ sudo chmod 777 /opt/bitnami/mysql/tmp sudo chmod 755 /opt/bitnami/mysql/data sudo chown root:root /opt/bitnami/mysql/tmp sudo chown mysql:root /opt/bitnami/mysql/data chmod 777 / opt / bitnami / mysql / tmp chmod 755 / opt / bitnami / mysql / data chown -R root:root / opt / bitnami / mysq / tmp chown mysql:root / opt / bitnami / mysql / data / sudo chmod 777 / opt / bitnami / mysql / tmp sudo chmod 755 / opt / bitnami / mysql / data sudo chown root:root / opt / bitnami / mysql / tmp sudo chown mysql:root / opt / bitnami / mysql / data

Also added skip-grant-tables in my.cnf 还在my.cnf中添加了skip-grant-tables

I also performed the following the query in the mysql 我也在mysql中执行了以下查询

GRANT ALL ON . 授予所有 to root@'%' IDENTIFIED BY 'SOMEPASSWORD'; 以root @'%'由“ SOMEPASSWORD”标识;

Any hint would be greatly appreciated. 任何提示将不胜感激。 Thanks in advance 提前致谢

To connect to your Bitnami MySQL, follow these steps: 要连接到您的Bitnami MySQL,请执行以下步骤:

1.Make sure your Azure VM have a public IP address . 1.确保您的Azure VM具有公共IP地址

2.Open port 3306 to NSG inbound rules : 2.打开端口3306到NSG 入站规则 在此处输入图片说明 3.Edit the file /opt/bitnami/mysql/my.cnf and comment out this line by placing a hash(#) symbol at the beginning, save it. 3.编辑文件/opt/bitnami/mysql/my.cnf并在开头添加一个/opt/bitnami/mysql/my.cnf (#),以注释掉这一行,然后保存。

#bind-address=127.0.0.1

4.At the server console, allow remote access to the MySQL database server using the MySQL command line client. 4.在服务器控制台上, 允许使用MySQL命令行客户端远程访问MySQL数据库服务器。 Use the following command, remembering to replace PASSWORD with the application password from the first step: 使用以下命令,并记住从第一步开始用应用程序密码替换PASSWORD:

/opt/bitnami/mysql/bin/mysql -u root -p -e "grant all privileges on *.* to 'root'@'%' identified by 'PASSWORD' with grant option";

5. Restart the MySQL server: 5. 重新启动 MySQL服务器:

sudo /opt/bitnami/ctlscript.sh restart mysql

Now, you can remote connect to your bitnami mysql. 现在,您可以远程连接到您的bitnami mysql。

Here is my result: 这是我的结果: 在此处输入图片说明

Hope this helps. 希望这可以帮助。

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

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