mysql连接报错:ERROR 2002 (HY000):Can't connect to MySQL server on '172.18.0.4' (115)

使用MySQL客户端连接远程amoeba进行远程控制数据库报错:

root@uduntu:~# mysql -u root -P8066  -h 172.18.0.4 -p
Enter password: 
ERROR 2002 (HY000): Can't connect to MySQL server on '172.18.0.4' (115)

求解答????在线等,可进行远程协调

下面是amoeba.xml内容:

<?xml version="1.0" encoding="gbk"?>

<!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd">
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/">

    <server>
        <!-- proxy server绑定的端口 -->
        <property name="port">8066</property>

        <!-- proxy server绑定的IP -->
        <property name="ipAddress">127.0.0.1</property>

        <!-- proxy server net IO Read thread size -->
        <property name="readThreadPoolSize">100</property>

        <!-- proxy server client process thread size -->
        <property name="clientSideThreadPoolSize">80</property>

        <!-- mysql server data packet process thread size -->
        <property name="serverSideThreadPoolSize">100</property>

        <!-- socket Send and receive BufferSize(unit:K)  -->
        <property name="netBufferSize">100</property>

        <!-- Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). -->
        <property name="tcpNoDelay">false</property>

        <!-- 对外验证的用户名 -->
        <property name="user">root</property>

        <!-- 对外验证的密码 -->

        <property name="password">redhat</property>

    </server>

    <!-- 
        每个ConnectionManager都将作为一个线程启动。
        manager负责Connection IO读写/死亡检测
    -->
    <connectionManagerList>
        <connectionManager name="defaultManager">
            <className>com.meidusa.amoeba.net.AuthingableConnectionManager</className>
        </connectionManager>
    </connectionManagerList>

    <dbServerList>
        <!-- 
            一台mysqlServer 需要配置一个pool,
            如果多台 平等的mysql需要进行loadBalance, 
            平台已经提供一个具有负载均衡能力的objectPool:com.meidusa.amoeba.mysql.server.MultipleServerPool
            简单的配置是属性加上 virtual="true",该Pool 不允许配置factoryConfig
            或者自己写一个ObjectPool。
        -->
        <dbServer name="server1">

            <!-- PoolableObjectFactory实现类 -->
            <factoryConfig>
                <className>com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory</className>
                <property name="manager">defaultManager</property>

                <!-- 真实mysql数据库端口 -->
                <property name="port">3306</property>

                <!-- 真实mysql数据库IP -->
                <property name="ipAddress">172.18.0.2</property>
                <property name="schema">test</property>

                <!-- 用于登陆mysql的用户名 -->
                <property name="user">jia</property>

                <!-- 用于登陆mysql的密码 -->


                <property name="password">redhat</property>


            </factoryConfig>

            <!-- ObjectPool实现类 -->
            <poolConfig>
                <className>com.meidusa.amoeba.net.poolable.PoolableObjectPool</className>
                <property name="maxActive">200</property>
                <property name="maxIdle">200</property>
                <property name="minIdle">10</property>
                <property name="minEvictableIdleTimeMillis">600000</property>
                <property name="timeBetweenEvictionRunsMillis">600000</property>
                <property name="testOnBorrow">true</property>
                <property name="testWhileIdle">true</property>
            </poolConfig>
        </dbServer>


        <dbServer name="multiPool" virtual="true">
            <poolConfig>
                <className>com.meidusa.amoeba.server.MultipleServerPool</className>
                <!-- 负载均衡参数 1=ROUNDROBIN , 2=WEIGHTBASED -->
                <property name="loadbalance">1</property>

                <!-- 参与该pool负载均衡的poolName列表以逗号分割 -->
                <property name="poolNames">server1</property>
            </poolConfig>
        </dbServer>

    </dbServerList>

    <queryRouter>
        <className>com.meidusa.amoeba.mysql.parser.MysqlQueryRouter</className>
        <property name="ruleConfig">${amoeba.home}/conf/rule.xml</property>
        <property name="functionConfig">${amoeba.home}/conf/functionMap.xml</property>
        <property name="ruleFunctionConfig">${amoeba.home}/conf/ruleFunctionMap.xml</property>
        <property name="LRUMapSize">1500</property>
        <property name="defaultPool">server1</property>

        <!--
        <property name="writePool">server1</property>
        <property name="readPool">server1</property>
        -->
        <property name="needParse">true</property>
    </queryRouter>
</amoeba:configuration>

1个回答

172.18.0.4
是这个ip么,是同一个网段么,mysql启动了没有,防火墙允许端口(通常是3306)了没有

KH_FC
弑天倾城 在不加入amoeba之前可以正常访问,加入了之后就报错了
7 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10013)

mysql登陆报这个错怎么办?,有没有大神帮一下啊。ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10013) mysql服务是运行的

MySQL报错求助 ERROR 2003 (HY000)

ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.12.6' (61) (Mac OS系统) mysql -h 127.0.0.1 没有问题,链接本机内网ip就链接不上了,服务都没问题。 netstat状态 tcp4 0 0 127.0.0.1.3306 *.* LISTEN 求助怎么远程链接到该数据库

mysql数据库连接问题:Can't connect to MySQL server on

我在远程服务器上的PHPmyadmin添加了任意主机的权限 ![图片说明](https://img-ask.csdn.net/upload/201811/07/1541560985_582055.jpg) 我在学校实验室主机上想连接那个数据库,然后出现了如下问题 C:\Users\Administrator>mysql -u root -p -h 我IP Enter password: ****** 然后:ERROR 2003 (HY000): Can't connect to MySQL server on '???(我那个ip)' (10060) 请问我可能在哪里出了问题,怎么解决

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10013)

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10013)mysql登陆报这个错怎么办?,有没有大神帮一下啊。

Linux连接mysql错误,ERROR 2002 (HY000)

执行如下操作有问题: ![图片说明](https://img-ask.csdn.net/upload/201611/01/1477985902_794124.png) 下面是mysql的状态: ![图片说明](https://img-ask.csdn.net/upload/201611/01/1477986774_572883.png)

在mac osx10.6下安装mysql后,启动总是报错ERROR 2002 (HY000): Can't connect to local MySQL ser

要在mac10.6下安装mysql以便rails开发,装了两天都没有成功。之前没用过mac或linux开发,一直用windows,所以希望高手们能指点一下。 我在安装时参考了以下文章: http://beike.iteye.com/blog/617341 http://hqman.iteye.com/blog/258979 下面是我的安装过程及错误: 安装和初始化mysql [code="java"]port search mysql sudo port install mysql5-server ########################################################### # A startup item has been generated that will aid in # starting mysql5-server with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo port load mysql5-server ########################################################### ---> Installing mysql5-server @5.1.50_0 ****************************************************** * In order to setup the database, you might want to run * sudo -u _mysql mysql_install_db5 * if this is a new install ****************************************************** ---> Activating mysql5-server @5.1.50_0 ---> Cleaning mysql5-server[/code] [code="java"]sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password' /opt/local/lib/mysql5/bin/mysqladmin -u root -h bogon password 'new-password' Alternatively you can run: /opt/local/lib/mysql5/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /opt/local/mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script![/code] 配置mysql: 开机自动启动mysql [code="java"]sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist [/code] 启动mysql 如果要快捷启动,则要先设置aliases,再用aliases来启动: mate ~/.profile打开这个配置文件,输入以下内容: [code="java"]alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &' alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'[/code] 启动mysql [code="java"]mysqlstart [1] 62478[/code] 如果没有设置aliases,则用以下命令来启动 /opt/local/share/mysql5/mysql/mysql.server start 验证mysql安装成功: [code="java"]mysqladmin5 -u root -p ping error: 'Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)' Check that mysqld is running and that the socket: '/opt/local/var/run/mysql5/mysqld.sock' exists! [/code] 或 [code="java"]mysql5 -u root –p ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)[/code] mate /opt/local/etc/mysql5/my.cnf并输入以下内容(参考http://beike.iteye.com/blog/617341): [code="java"][mysqld_safe] socket = /tmp/mysql.sock[/code] 再调用 mysql5 -u root –p还是报相同错误。

mysqli_connect():( HY000 / 2002):连接被拒绝(远程MySQL)

<div class="post-text" itemprop="text"> <p>I have one shared Cpanel Hosting and one My own server with cpanel hosting. I am trying to connect from shared cpanel hosting to my own server for get data from my own server. I have added my shared cpanel hosting IP to my server cpanel in remote MySQL section but I am getting above error. I have also added that IP from WHM but not success. I have checked that port 3306 also open. I do not know whats issue. I have tried below connection type but same error always.</p> <pre><code>$SERVER_NAME = "195.201.XXX.XXX"; $USER_NAME = "MyUserName"; $PASSWORD = "MyPass"; $DATABASE = "Mydb"; $conn = mysqli_connect($SERVER_NAME, $USER_NAME, $PASSWORD, $DATABASE,"3306"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } </code></pre> <p>I have also tried below code</p> <pre><code> $SERVER_NAME = "195.201.XXX.XXX"; $USER_NAME = "MyUserName"; $PASSWORD = "MyPass"; $DATABASE = "Mydb"; $conn = mysqli_connect($SERVER_NAME, $USER_NAME, $PASSWORD, $DATABASE); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } </code></pre> <p>But I am getting error like this</p> <pre><code>Failed to connect to MySQL: Connection refused </code></pre> <p>and in error log like this</p> <pre><code>mysqli_connect(): (HY000/2002): Connection refused in </code></pre> <p>Let me know whats wrong with it and how can I solve it. Thanks</p> </div>

托管项目时的连接问题:SQLSTATE [HY000] [2002]连接被拒绝

<div class="post-text" itemprop="text"> <p>I'm trying to connect my project laravel to an external server, it's connected just fine when it's in localhost, but when I try to host it to a server it shows me this error </p> <pre><code>SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `cdr` where `dst` in (0, 0, 0)) </code></pre> <p>This is my database.php and .env </p> <p>database.php</p> <pre><code> 'mysqlExtern' =&gt; [ 'driver' =&gt; 'mysql', 'host' =&gt; env('DB_HOST_EXT', '187.164.77.77'), 'port' =&gt; env('DB_PORT_EXT', '3306'), 'database' =&gt; env('DB_DATABASE_EXT', 'testDb'), 'username' =&gt; env('DB_USERNAME_EXT', 'xxxx'), 'password' =&gt; env('DB_PASSWORD_EXT', 'xxxxx'), ], </code></pre> <p>.env </p> <pre><code>DB_CONNECTION=mysqlExtern DB_HOST_EXT=187.164.77.77 DB_PORT_EXT=3306 DB_DATABASE_EXT=testDb DB_USERNAME_EXT=coga DB_PASSWORD_EXT=RTgh457 </code></pre> </div>

MYSQL登录报错,提示Error 2002

重新安装mysql后,在启动服务登录时报ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 这样的错误,求解答。

致命错误:未捕获PDOException:SQLSTATE [HY000] [2019]未知字符集

<div class="post-text" itemprop="text"> <p>I am trying to learn about PDOs so I can migrate away from using mysqli functions but I can't seem to get the DSN right when connecting to the database. I don't know what charset to use. Is it something that I determine in phpmyadmin or is it something that is already set and I have to find? Not sure.</p> <p>I have a MySQL database set up on a XAMPP program that I am trying to connect to. Below is my code from my db.php file and the full error message.</p> <pre><code>// CREATE PDO OBJECT WITH CONSTRUCTOR $db = new PDO('mysql:host=localhost;dbname=phpdemo;charset=utf8', 'root', ''); // SET ATTRIBUTE RELATED TO ERROR HANDLING FOR SECURITY $db -&gt; setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $fb -&gt; setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); </code></pre> <blockquote> <p>Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2019] Unknown character set in C:\xampp\htdocs\PHP\PDO Lab\includes\db.php:3 Stack trace: #0 C:\xampp\htdocs\PHP\PDO Lab\includes\db.php(3): PDO-&gt;__construct('mysql:host=loca...', 'root', '') #1 C:\xampp\htdocs\PHP\PDO Lab\includes\header.php(6): include_once('C:\xampp\htdocs...') #2 C:\xampp\htdocs\PHP\PDO Lab ew_user.php(2): include_once('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\PHP\PDO Lab\includes\db.php on line 3</p> </blockquote> <p>Edit: I have tried using utf8mb4 which results in the same error.</p> <p>Edit2: I just realized that I don't get any errors when I open my db.php file. I do get errors when I open my new_user.php file who's only code is "include('db.php');"</p> </div>

ERROR 2002(HY000):无法通过套接字连接到本地MySQL服务器'/Applications/MAMP/tmp/mysql/mysql.sock'(2)

<div class="post-text" itemprop="text"> <p>如标题所示,当我尝试从终端启动MySQL时收到错误:</p> <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) </code></pre> <p>我在运行时收到此错误:</p> <pre><code>/Applications/MAMP/Library/bin/mysql -u root -p </code></pre> <p>我在运行时没有收到此错误:</p> <pre><code>mysql -u root -p </code></pre> <p>但是问题是当我运行的时候 <code>mysql -u root -p</code> 它连接到错误的MySQL ...</p> 在OSX上,我有两个用户,主要用户(一个正在发生错误的用户)在运行上述命令时访问其自己的mySQL实例(为空)。 当我运行该命令时,辅助用户将访问不同的mySQL实例(具有所需数据的实例)。 当然问题是,我试图在主要用户上访问辅助用户MySQL实例(我应该注意,在注销之前,我已经做得更早了,现在出现此错误) 另外,我应该提到,MAMP已安装在辅助用户上(即使MAMP文件可以从任一用户访问); 并且使用MAMP gui来“启动服务器”时,辅助用户上没有问题,但是主要用户上Apache Server启动了,但是MySQL Server没有启动。 通过搜索,我听说可以运行<code>killall -9 mysqld</code>或者 <code>killall mysqld</code>然后再尝试一切(有意义)。但我没有成功。 此外,我看到你们还应运行其他两个命令以进行调试,虽然我不知道它们的含义,但我知道它返回了 <pre><code>ps -u mysql </code></pre> <pre><code>UID PID TTY TIME CMD </code></pre> <p>和返回的</p> <pre><code>ps -awwx | grep mysql </code></pre> <pre><code>8001 ?? 0:00.03 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql 16527 ?? 0:00.43 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/MacBook-Pro.local.err --pid-file=/usr/local/var/mysql/MacBook-Pro.local.pid 81182 ?? 0:00.04 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log 18520 ttys002 0:00.00 grep mysql </code></pre> </div>

连接错误 - SQLSTATE [HY000] [2002]操作超时

<div class="post-text" itemprop="text"> <p>I am having trouble connecting from my application server which is a Windows 2008 R2 box to MySQL Server box also running on Windows 2008 R2.</p> <p>The Laravel application reports the error:</p> <pre><code>exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Operation timed out' </code></pre> <p>The odd thing is I <strong>can</strong> connect via MySQL Workbench from the application server to the MySQL Server using exactly the same credentials and port, and the connection is quick.</p> <p>Can anyone shed any light on how this can be?</p> </div>

mysqli :: real_connect():( HY000 / 2002):无法建立连接,因为目标计算机主动拒绝它

<div class="post-text" itemprop="text"> <p>I've this problem when I'm trying to run my PHP MySQL script. When I try to run my .php file this is what I get.</p> <p><strong>A PHP Error was encountered</strong></p> <p>Severity: Warning</p> <blockquote> <p>Message: mysqli::real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.</p> </blockquote> <pre><code>Filename: mysqli/mysqli_driver.php </code></pre> <p>Line Number: 135</p> <p>Backtrace:</p> <blockquote> <p>File: C:\wamp\www\acc\index.php Line: 292 Function: require_once</p> </blockquote> <p><a href="https://i.stack.imgur.com/wsUOi.jpg" rel="nofollow noreferrer">image</a></p> </div>

PHP PDO:SQLSTATE [HY000] [2002]无法建立连接,因为目标计算机主动拒绝它。

<div class="post-text" itemprop="text"> <p>I'm looking for a solution of my issue with PHP and PDO.. </p> <pre><code>try { $db = new PDO("mysql:dbname=PHP;host=localhost", "User", "Password"); // set the PDO error mode to exception } catch(PDOException $e) { echo 'Fehler: ' . htmlspecialchars($e-&gt;getMessage()); exit(); } </code></pre> <p>I don't know how to fix it... any ideas? I tried to change the port to 3306 like here:</p> <pre><code>$db = new PDO("mysql:dbname=PHP;port=3306;host=localhost", "User", "Password"); </code></pre> <p>but it didn't change anything.</p> <p>Thanks</p> </div>

警告:mysqli_connect():( HY000 / 1045):用户'usr'@'localhost'拒绝访问(使用密码:YES)

<div class="post-text" itemprop="text"> <blockquote> <p>Warning: mysqli_connect(): (HY000/1045): Access denied for user 'usr'@'localhost' (using password: YES) in /storage/emulated/0/htdocs/includes/condb.php on line 9 Failed to connect to MySql: Access denied for user 'usr'@'localhost' (using password: YES) Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /storage/emulated/0/htdocs/includes/condb.php on line 19</p> <p>Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /storage/emulated/0/htdocs/includes/condb.php on line 20 Unable to connect</p> </blockquote> <p>我试图连接到数据库使用这段代码,但都不行。我不知道我到底做错了什么。我试过用谷歌搜索和阅读一些文章,但都没用。</p> <p>更新的代码仍然得到上面的错误消息。 </p><pre><code> $server = "127.0.0.1"; $username = "usr"; $password = "123"; $database = "contents"; $conn = mysqli_connect($server,$username,$password,$database); if(mysqli_connect_errno($conn)) { echo "Failed to connect to MySql: ".mysqli_connect_error(); } $sql = "INSERT INTO contents('subj','article','day') VALUES ('".$_POST['This is the subj']."', '".$_POST['This is the content']."', '".$_POST['2019-02-01 10:15:59']."')"; if(!mysqli_query($conn,$sql)) { die("Unable to connect".mysqli_error($conn)); }else { echo "Connected"; } ?&gt; </code></pre> <p>不幸的是,仍然遇到相同的错误,这不是一个印刷错误。 至今仍无法解决这个问题。 有解决问题能力的人可以帮助我一下。</p> </div>

SQLSTATE [HY000] [2002]操作超时[重复]

<div class="post-text" itemprop="text"> <div class="question-status question-originals-of-duplicate"> <p>This question already has an answer here:</p> <ul> <li> <a href="/questions/31897406/pdoexception-sqlstatehy000-2002-connection-timed-out-on-my-local-computer" dir="ltr">PDOException SQLSTATE[HY000] [2002] Connection timed out on my local computer</a> <span class="question-originals-answer-count"> 1 answer </span> </li> </ul> </div> <p>I am creating a pdo data connection. The connections works fine on localhost. But when I connect to my remote db, and use exactly the same credentials which I have used before, I get a empty page, no error messages, just a empty page.</p> <p>The same credentials that are working on a previous project were done with mysqli, this one is done with pdo.</p> <p>I have tried two types of pdo connection code, none of them are working.</p> <p>First one:</p> <pre><code>$databaseHost = 'x.xxx.xxx.xx'; $databaseName = 'xxxxxxxxx'; $databaseUsername = 'xxxxxxx'; $databasePassword = 'xxxxxx'; $charset = 'utf8'; try { $dsn = "mysql:host=$databaseHost;dbname=$databaseName;charset=$charset"; } catch(PDOException $e) { echo 'Connection failed: ' . $e-&gt;getMessage(); } $opt = [ PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE =&gt; PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES =&gt; false, ]; $pdo = new PDO($dsn, $databaseUsername, $databasePassword, $opt); </code></pre> <p>Second one:</p> <pre><code>$databaseHost = 'x.xxx.xxx.xx'; $databaseName = 'xxxxxxxxx'; $databaseUsername = 'xxxxxxx'; $databasePassword = 'xxxxxx'; $opt = [ PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE =&gt; PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES =&gt; false, ]; try { $pdo = new PDO("mysql:host={$databaseHost};dbname={$databaseName}", $databaseUsername, $databasePassword, $opt); } catch(PDOException $e) { echo 'Connection failed: ' . $e-&gt;getMessage(); } </code></pre> <p>Even though both connections work in localhost, I tried to just load this connection page locally in the browser, the fist option gave me this error:</p> <blockquote> <p>Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Operation timed out in /Applications/MAMP/htdocs/ijdb_pdo/config.php:24 Stack trace: #0 /Applications/MAMP/htdocs/ijdb_pdo/config.php(24): PDO-&gt;__construct('mysql:host=83.1...', 'u1164707_sohail', 'sohail123', Array) #1 {main} thrown in /Applications/MAMP/htdocs/ijdb_pdo/config.php on line 24</p> </blockquote> <p>and the second option gave me the following error:</p> <blockquote> <p>againtestConnection failed: SQLSTATE[HY000] [2002] Operation timed out</p> </blockquote> <p>What am i messing up in my code?</p> <p>I tried then to connect through the terminal with:</p> <pre><code>MacBook-Pro-3:/ sohail$ /Applications/MAMP/Library/bin/mysql -h "xx.xxx.xxx.xx" -u "xxxxxx" "-pxxxxxxx" "xxxxxxx"; </code></pre> <p>and got the following error:</p> <blockquote> <p>Warning: Using a password on the command line interface can be insecure. ERROR 2003 (HY000): Can't connect to MySQL server on 'xx.xxx.xxx.xx' (60) MacBook-Pro-3:/ sohail$</p> </blockquote> <p>I don't think I have terminal access on my remote machine, so I can't do SHOW GLOBAL VARIABLES LIKE 'PORT'; cmd -thanks</p> </div>

SQLSTATE [HY000]:常规错误:2006 MySQL服务器已经离开创建临时表

<div class="post-text" itemprop="text"> <p>Everything I've seen is due to plugins or "weird" configurations or data sets.</p> <p>I'm trying to do something very simple with PHP, MySQL, and PDO.</p> <pre><code> $table_name = 'TEMP_' . time(); $sql_commands = "CREATE TEMPORARY TABLE {$table_name} (X CHAR(1));"; $conn = Database::factory(); $stmt = $conn-&gt;prepare($sql_commands); $stmt-&gt;execute(); </code></pre> <p>Database::factory() is essential returning a PDO object created from:</p> <pre><code>$opt = [ PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE =&gt; PDO::FETCH_ASSOC, PDO::MYSQL_ATTR_INIT_COMMAND =&gt; "SET time_zone = '" . TIME_ZONE . "';", PDO::MYSQL_ATTR_INIT_COMMAND =&gt; "SET SESSION group_concat_max_len = 10485760;", ]; $dsn = "mysql:dbname=$database;host=$hostname;port=$port;charset=utf8"; </code></pre> <p>Every time I try to create temporary tables I get this error:</p> <pre><code>SQLSTATE[HY000]: General error: 2006 MySQL server has gone away </code></pre> <p>However the table does get created (At least, if I rerun too quick I get another error stating the table already exists.)</p> <p>Contents of /etc/my.cnf</p> <pre><code>max_allowed_packet=128MB # tried various values from 8MB up to 4GB datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock secure_file_priv="" symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid </code></pre> <p>For brevity of this post <a href="https://pastebin.com/BpT40wUJ" rel="nofollow noreferrer">SHOW VARIABLES DUMP</a> is pastebin'd.</p> </div>

MySQL说:文档无法连接:无效设置

<div class="post-text" itemprop="text"> <p>i am using XANPP.when i tried to login into phpMyAdmin i got an error.</p> <hr> <p>MySQL said: Documentation</p> <p>Cannot connect: invalid settings. mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client Connection for controluser as defined in your configuration failed. mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.</p> <hr> <p>even i changed Mysql password also. and i given password in config.inc.php file.</p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>&lt;?php /* * This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'root'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = ''; /* Bind to the localhost ipv4 address and tcp */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; /* User for advanced features */ $cfg['Servers'][$i]['controluser'] = 'pma'; $cfg['Servers'][$i]['controlpass'] = ''; /* Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; $cfg['Servers'][$i]['relation'] = 'pma__relation'; $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; $cfg['Servers'][$i]['history'] = 'pma__history'; $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords'; $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; $cfg['Servers'][$i]['recent'] = 'pma__recent'; $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; $cfg['Servers'][$i]['users'] = 'pma__users'; $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; /* * End of servers configuration */ ?&gt;</code></pre> </div> </div> </div>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

C++11:一些微小的变化(新的数据类型、template表达式内的空格、nullptr、std::nullptr_t)

本文介绍一些C++的两个新特性,它们虽然微小,但对你的编程十分重要 一、Template表达式内的空格 C++11标准之前建议在“在两个template表达式的闭符之间放一个空格”的要求已经过时了 例如: vector&lt;list&lt;int&gt; &gt;; //C++11之前 vector&lt;list&lt;int&gt;&gt;; //C++11 二、nullptr ...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

深入剖析Springboot启动原理的底层源码,再也不怕面试官问了!

大家现在应该都对Springboot很熟悉,但是你对他的启动原理了解吗?

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

【阿里P6面经】二本,curd两年,疯狂复习,拿下阿里offer

二本的读者,在老东家不断学习,最后逆袭

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

微软为一人收购一公司?破解索尼程序、写黑客小说,看他彪悍的程序人生!...

作者 | 伍杏玲出品 | CSDN(ID:CSDNnews)格子衬衫、常掉发、双肩包、修电脑、加班多……这些似乎成了大众给程序员的固定标签。近几年流行的“跨界风”开始刷新人们对程序员的...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

我说我懂多线程,面试官立马给我发了offer

不小心拿了几个offer,有点烦

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

立即提问
相关内容推荐