无法连接到MySQL:用户'root'@'localhost'拒绝访问

Could not connect to MySQL: Access denied for user 'root'@'localhost' (using password: NO)

我不能使用用户名(Root)访问我的数据库,也不能使用任何密码,我该怎么办?我也不能通过MySQL控制台访问。我试图配置config.inc.php文件,但没有作用。

请告诉我如何不丢弃WAMP,也不需要重新装载。

十分感谢

Aleksandar

展开翻译

译文


无法连接到MySQL:用户'root'的访问被拒绝@'localhost'
(使用密码:否)</ p>
</ blockquote>

我无法使用之前的用户名(root)</ strong>访问我的数据库,而不能使用任何密码。 我应该做些什么。 我也无法通过mysql控制台访问。 我试图配置config.inc.php文件,但没有用。</ p>

请告诉我不要丢弃WAMP并安装新的。</ p>
\ n

问候,</ p>

Aleksandar </ p>
</ div>

dtc66318
dtc66318 dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
3 年多之前 回复
dongshao1981
dongshao1981 你有一个mysqlgui客户端-比如heidi或mySQLAdministrator应用程序?
3 年多之前 回复
duanjie1339
duanjie1339 请分享您的代码
3 年多之前 回复

1个回答

It seems that you have forgotten your mysql root user password. I think you should reinstall WAMPP and then set the mysql root user password from command line. To set the mysql root user password you have to first login to mysql from command line using this command: mysql -u root. When it asks for password just enter. After that enter following commands:

SET PASSWORD for 'root'@'localhost' = password('enteryourpassword');
SET PASSWORD for 'root'@'127.0.0.1' = password('enteryourpassword');
SET PASSWORD for 'root'@'::1' = password('enteryourpassword');

展开翻译

译文



您似乎忘记了自己的mysql root用户密码。 我想你应该重新安装WAMPP,然后从命令行设置mysql root用户密码。 要设置mysql root用户密码,首先必须使用以下命令从命令行登录mysql:mysql -u root。 当它要求输入密码时。 之后输入以下命令:</ p>

  SET PASSWORD for'root'@'localhost'= password('enteryourpassword'); 
SET PASSWORD for'root'@'127.0.0.1 '= password('enteryourpassword');
为'root'的密码@':: 1'=密码('enteryourpassword');
</ code> </ pre>
</ div>

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
无法连接到数据库:用户''@ localhost'拒绝访问数据库'socialdb'

<div class="post-text" itemprop="text"> <p>I've seen a few errors like this, but I found no answer.</p> <pre><code>Unable to connect to database: Access denied for user ''@'localhost' to database 'socialdb' </code></pre> <p>socialdb is my database. The "Unable to connect to database:" part is located here.</p> <pre><code>$db = mysql_select_db("socialdb",$con); if(!$db) { die ('Unable to connect to database: ' . mysql_error()); } </code></pre> <p>I don't know what's causing this. Here are my mysql_connect details</p> <pre><code>&lt;?php $con = mysql_connect("localhost"); if(!$con) { die ('Error: ' . mysql_error()); } </code></pre> <p>I need to find the root. Thanks.</p> <p>I DON'T HAVE A USERNAME OR PASSWORD FOR MySQL</p> <p>Should it be this?</p> <pre><code>mysql_connect("localhost","",""); </code></pre> </div>

linux 部署PHP环境 被拒绝访问 mysql root@localhost

在腾讯云 部署PHP+mysql+apche环境 当我链接数据库时(php函数的参数没有错误),被决绝访问 具体的代码如下: ![图片说明](https://img-ask.csdn.net/upload/201908/12/1565603325_854223.png) 本地访问服务器页面是,提示如下错误: ![图片说明](https://img-ask.csdn.net/upload/201908/12/1565603452_449572.png)

不能上到MySQL服务器连接“localhost”!

安装MySQL-Front后打开就出现这种情况:“不能上到MySQL服务器连接“localhost”!” 服务器名称为:localhost 端口号为3306 连接类型为:Direct 用户名为:root 密码:123456 (注册信息是打开mysql后设置的,密码按照网上试了一遍:"123" 、为空,都不行) 安装在C盘program Files(x86)下,里面 文件夹有Languages,Skins 文件有:libMySQL.php,MySQL-Front.chm,MySQL-Front.pdf ,PAD_File.xml ,unins000.dat 安装程序有:unins000.exe , MySQL-Front.exe (按照网上 键入 mysql -u root -p,回车 提示“mysql”不是内部或外部命令,也不是可运行的程序或批处理文件。) 其他的改密码 改连接127.0.0.1 改hosts文件 都试过不行啊 求大神指导 应该怎么解决 ,要改哪么? 网上的方法不是不适用就是没有用 , 没办法 , 求帮忙了!!!!! 急!!!!非常感谢!!!!!!

访问被拒绝用户'root'@'localhost'(使用密码:否)[复制]

<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/41645309/mysql-error-access-denied-for-user-rootlocalhost" dir="ltr">MySQL Error: : 'Access denied for user 'root'@'localhost'</a> <span class="question-originals-answer-count"> 11 answers </span> </li> <li> <a href="/questions/8484722/access-denied-for-user-rootlocalhost-while-attempting-to-grant-privileges" dir="ltr">Access denied for user 'root'@'localhost' while attempting to grant privileges. How do I grant privileges?</a> <span class="question-originals-answer-count"> 12 answers </span> </li> <li> <a href="/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost" dir="ltr">ERROR 1698 (28000): Access denied for user 'root'@'localhost'</a> <span class="question-originals-answer-count"> 11 answers </span> </li> <li> <a href="/questions/19482371/fix-access-denied-for-user-rootlocalhost-for-phpmyadmin" dir="ltr">Fix Access denied for user 'root'@'localhost' for phpMyAdmin</a> <span class="question-originals-answer-count"> 15 answers </span> </li> <li> <a href="/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw" dir="ltr">MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)</a> <span class="question-originals-answer-count"> 33 answers </span> </li> </ul> </div> <p>I have an ecommerce website and i m trying to move from localhost windows to linux mint localhost.. I can log in to phpmyadmin , so i know the root and the password, i changed the config.inc.php and AllowNoPassword = True but when i try localhost/ecommerce i get access denied and Using PAssword (NO)..</p> <pre><code>$db = mysqli_connect('localhost', 'root', 'admin', 'ecommerce'); if(mysqli_connect_errno()) { echo 'Database connection failed with following errors: '.mysqli_connect_error(); die(); </code></pre> </div>

无法连接:用户'root'@'localhost'拒绝访问(使用密码:否)

<div class="post-text" itemprop="text"> <p>Following is the code in which i tried to submit the form details to the mysql database in my cpanel of godaddy. </p><pre><code> $nameErr = $emailErr = $phnoErr= ""; $name = $area = $address = $phno = $email = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("fecustomer", $con); $name = $_POST["name"]; if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } $area = $_POST["area"]; $address = $_POST["address"]; $phno = $_POST["phno"]; if (!preg_match("/^[0-9 ]*$/",$phno)) { $phnoErr = "Only 10 digits allowed"; } $email = $_POST["email"]; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $query = " INSERT INTO `fecustomer`.`details` (`name`, `area`, `address`, `email`, `phno`, `timestamp`) VALUES ('$name','$area','address','phno' '$email');"; mysql_query($query); echo "&lt;p&gt;Thank you for your Comment!&lt;/p&gt;"; mysql_close($con); } else echo "dint insert"; ?&gt; </code></pre> <p>I have registered my domain and hosting in godaddy.i wanted to use the database in that itself.Have i udes the mysql of local wamp server.Are both different?what should i do.Thank you</p> </div>

用户'root'@'localhost'拒绝访问(使用密码:YES)

<div class="post-text" itemprop="text"> <p>I know the title looks familiar but no. I was working on a web app, and when I ran it, it says: Access denied for user 'root'@'localhost' (using password: NO). I searched some sites and they said that I should use a password. So I changed the password using mysql console. Than I got this message Access denied for user 'root'@'localhost' (using password: YES). And when I reenter the mysql console and put the password it makes a beep than it is closed. I got this event log:</p> <blockquote> <pre><code>Log Name: Application </code></pre> <p>Source: .NET Runtime Date: 10/18/2015 7:12:51 PM Event ID: 1026 Task Category: None Level: Error Keywords: Classic User: N/A Computer: TOSHIBA-TOSH Description: Application: MySQLWorkbench.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.Remoting.RemotingException Stack: at System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.StartListening(System.Object) at MySQL.Workbench.ApplicationInstanceManager.RegisterRemoteType(System.String) at MySQL.Workbench.ApplicationInstanceManager.CreateSingleInstance(System.String, System.String[], System.EventHandler`1)<br> at MySQL.GUI.Workbench.Program.Main(System.String[])</p> <p>Event Xml: <br> 1026 2 0 0x80000000000000 537897 Application TOSHIBA-TOSH Application: MySQLWorkbench.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.Remoting.RemotingException Stack: at System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.StartListening(System.Object) at MySQL.Workbench.ApplicationInstanceManager.RegisterRemoteType(System.String) at MySQL.Workbench.ApplicationInstanceManager.CreateSingleInstance(System.String, System.String[], System.EventHandler`1&lt;MySQL.Workbench.InstanceCallbackEventArgs&gt;) at MySQL.GUI.Workbench.Program.Main(System.String[]) <br> </p> </blockquote> <p>Any help ? I uninstalled everything (wamp, mysql, dreamweaver,.........) but still got the same problem. And mysql workbench give this error when i enter the password <a href="https://i.stack.imgur.com/rJqUb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rJqUb.jpg" alt="This error"></a>.</p> <p>I tried to use config.inc.php solutions but still the same.</p> </div>

碰到no suitable driver found for jdbc:mysql//localhost:3306/qzhao 错误

我在家里的电脑上用eclipse建了一个简单的hibernate工程. 运行的时候碰到no suitable driver found for jdbc:mysql//localhost:3306/qzhao 异常。 我在网上搜了很多答案,比如把jar放在jre/lib/ext下面,都不行。 奇怪的是在我单位工作电脑上,同样的项目就能work。也没有把jar包放在jre下面。我家里用的是win7,jdk装在C:\pogram files下面。连接配置都是好的。还有家里mysql是和eclipse装在同一台电脑上。工作单位是在服务器上。 请高手解释?昨晚折腾了一夜。最后网速暴慢就睡觉了。 [b]问题补充:[/b] 我的不是一个web程序,就是一个普通的eclipse java project。我已经把jar加到eclipse project里面了。而且用这个jar包用一般的java code可以连接啊 [b]问题补充:[/b] 谢谢各位的答案 出现这样的情况,一般有四种原因: 一:连接URL格式出现了问题(Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX") [qzhao]:我的配置如下: <!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://10.111.3.244:3306/qzhao_opbook</property> <property name="connection.username">qzhao</property> <property name="connection.password">qzhao</property> <!-- JDBC connection pool (use the built-in) --> <property name="connection.pool_size">1</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- Enable Hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <!-- Disable the second-level cache --> <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup --> <property name="hbm2ddl.auto">update</property> <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml" /> 而且在我单位电脑能work 二:驱动字符串出错(com.mysql.jdbc.Driver) 三:Classpath中没有加入合适的mysql_jdbc驱动(驱动要和你的数据库版本一致) 这个我用的是mysql-connector-java-5.0.4-bin.jar,数据库是5.0 四:驱动jar包放的位置不对 我把它加到eclipse project build path里面的。同样在单位电脑上可以工作的。所以我很疑惑,难道是因为家里的电脑jdk路径下面有空格或者是win7的原因?? [b]问题补充:[/b] 问题找到了,是url错了。 分就给walsh吧

jdbc无法连接MySQL数据库

报错信息:No suitable driver found for jdbc:mysql://localhost:3306/utf-8?useUnicode=true&characterEncoding=utf-8 我写的url:url="jdbc:mysql://localhost:3306/utf-8?useUnicode=true&characterEncoding=utf-8"; 直接用main方法调用连接可以正常查询,但是从action中调用就会报错 这是采用main方法调用 ``` public static void main(String[] args) { UserBiz ubiz=new UserBizImpl(); String username="张三"; String password="123"; Users user=ubiz.getUser(username, password); System.out.println(user); } ``` 这是在action中调用 ``` protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username=request.getParameter("username"); System.out.println(username); String password=request.getParameter("password"); System.out.println(password); UserBiz ubiz=new UserBizImpl(); Users user=ubiz.getUser(username, password); ```

无法连接到MySQL:(1045)用户'root'@'localhost'拒绝访问(使用密码:YES)[复制]

<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/16845715/1045-access-denied-for-user-rootlocalhost-using-password-yes" dir="ltr">#1045 - Access denied for user 'root'@'localhost' (using password: YES)</a> <span class="question-originals-answer-count"> 21 answers </span> </li> </ul> </div> <p>I am deploying a Wordpress enviroment, and there seems to happen a weird situation.</p> <p>I did some tweakings and set a new root password like this</p> <pre><code>mysql -u root –p SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyNewPass'; service mysql restart ufw allow 3306 </code></pre> <p>then I changed the settings of <code>bind</code> from <code>/etc/mysql/mysql.conf.d</code> to from <code>127.0.0.1</code> to <code>0.0.0.0</code> so that I can access it via mySQL Workbench. Which was successful as I now am able to enter the DB from outside sources.</p> <p>Once I changed the password, I altered the <code>wp-config.php</code> file and set the new credentials.</p> <p><a href="https://i.stack.imgur.com/oL5j2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oL5j2.png" alt="enter image description here"></a></p> <p>However, now, I am getting errors inside the WordPress whenever I log on, I see the following errors, despite the fact that the website runs without any issues and the articles appear.</p> <pre><code> Failed to connect to MySQL: (1045) Access denied for user 'root'@'localhost' (using password: YES) </code></pre> <p>Below is an image of the error I am getting</p> <p><a href="https://i.stack.imgur.com/CzRgn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CzRgn.png" alt="enter image description here"></a></p> <p>I tried manny different scenarios on SO, and I am really sorry in advance for posting this again, but non of the solutions provided work. </p> <p>Any ideas on resolving this?</p> <p>And while we are at it,</p> <ol> <li>what does <code>(using password: YES)</code> or <code>(using password: NO)</code> mean ?</li> <li>What is the difference between <code>root@localhost</code> and <code>root@127.0.0.1</code></li> </ol> </div>

关于java JDBC连接的问题(localhost 与127.0.0.1)

主题: jdbc连接中 如何强制规定使用localhost连接(因为虚拟主机只认localhost不支持127.0.0.1) 事件经过: 昨天租了一个虚拟主机,主机上面的MYSQL数据库只能通过localhost来访问,这本来也不是什么问题。 但是,程序上传到虚拟主机空间上连数据库却出现了问题,刚开始用的是hibernate,提示数据库连接失败。以为是主机不支持hibernate,遂更换成了手写的JDBC连接,这回得到的异常是 Access denied for user 'xxxxxx'@'127.0.0.1' 很显然,是数据库登录错误。 顺带把连接写一下 DBDRIVER = "com.mysql.jdbc.Driver"; DBPATH = "jdbc:mysql://localhost:3306/xxxxxx"; USERNAME = "xxxxxx"; PASSWORD = "aabbccddee"; 上面的连接 通过程序连接的时候被转为了127.0.0.1 但是 虚拟主机上面是不支持127.0.0.1的

php artisan migrate:使用mamp:拒绝访问用户'root'@'localhost'

<div class="post-text" itemprop="text"> <p>I have a Laravel project with MAMP. I tried to connect to my database with MySQL Server in phpMyAdmin. The <code>php artisan migrate</code> command gives this error: </p> <pre><code> Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select max(`batch`) as aggregate from `migrations`) at /Applications/MAMP/htdocs/todoapp/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) { &gt; 664| throw new QueryException( 665| $query, $this-&gt;prepareBindings($bindings), $e 666| ); 667| } 668| Exception trace: 1 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)") /Applications/MAMP/htdocs/todoapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70 2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=tododb", "root", "root", []) /Applications/MAMP/htdocs/todoapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70 Please use the argument -v to see more details. </code></pre> <p>my env. file </p> <pre><code>DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=tododb DB_USERNAME=root DB_PASSWORD=root </code></pre> </div>

为phpMyAdmin修复用户'root'@'localhost'的访问被拒绝

<div class="post-text" itemprop="text"> <p>I'm using WAMP Server 2.2 on a PC. In phpMyAdmin (version 5.5.24) I edited the 'root' user (with 'localhost' host) and gave it a password of 'root'. This turned out to be a big mistake that I'm trying to revert. Now when I go to <strong>localhost/phpmyadmin/</strong> I get the menu of databases on the left, but the main frame has an error that reads:</p> <pre><code>#1045 - Access denied for user 'root'@'localhost' (using password: NO) 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. </code></pre> <p>If I go to <strong>127.0.0.1/phpmyadmin</strong>, I do <em>not</em> get the error and everything works fine.</p> <p>I tried changing the user's password back to no password; I tried modifying config.inc.php file to add the new password (but that made phpMyAdmin error-out completely); I tried removing and recreating the root/localhost user. Nothing seems to work. The root/localhost user appears to have no password and all privileges, but the error remains.</p> <p>Any ideas or how I can get this user's access back to normal without having to reinstall WAMP?</p> </div>

PHP无法连接到MySQL数据库访问被拒绝

<div class="post-text" itemprop="text"> <p>I get this error message </p> <blockquote> <p>Access denied for user 'user'@'localhost' (using password: YES)</p> </blockquote> <p>I tried to access with the root, the admin account and some user account I made for the web visitors with a few privileges. Those users (admin and web user) were created with cPanel.</p> <p>I'm testing the connection with this simple code to avoid making a mess with functional code.</p> <pre><code>&lt;?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } ?&gt; </code></pre> <p>I stumbled with this explanation but it doesn't work either</p> <blockquote> <p>Your cPanel username and password can be used to connect to your databases (as well as your cPanel). If you're connecting to your database using your cPanel username and password, you can reset your cPanel password to ensure you are using the correct username and password.</p> <p>If you setup a MySQL username and password specifically for accessing a database, you'll want to ensure you are using the correct username in your php scripts. For example, MySQL usernames are always in this format:</p> <p>cpanel-username_mysql-username</p> <p>If your cPanel username is userna5 and you created a database username of dbuser1, then the actual database username would be:</p> <p>userna5_dbuser1</p> </blockquote> <p>Edit: i already assigned the users to a database and their privileges. I'm working on a remote server</p> </div>

远程连接服务器上,在自己的帐号下建立java连接mysql的程序,但是一直连接不上

我是通过远程连接在实验室机房的一台机器(linux操作系统)上,然后在该机器上建立JAVA程序,其中涉及到连接mysql数据库的操作,但是在获取连接时一直提示“Communications link failure“,涉及的代码为:connect=DriverManager.getConnection("jdbc:mysql://localhost:3306/pyq_test","root","120116"); [在linux终端查找mysql的所有用户/密码及主机的结果为:](https://img-ask.csdn.net/upload/201505/23/1432343964_536852.png) ![java程序报错](https://img-ask.csdn.net/upload/201505/23/1432344075_276126.png)

mysql本地root用户登不进去

[root@centos-512mb-sgp1-01 ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root' @'localhost' (using password: YES) [root@centos-512mb-sgp1-01 ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root' @'localhost' (using password: YES) [root@centos-512mb-sgp1-01 ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root' @'localhost' (using password: NO) [root@centos-512mb-sgp1-01 ~]#

无法连接到mysql docker镜像连接被拒绝

<div class="post-text" itemprop="text"> <p>I just replaced my old company computer for a new one(MACOS), download the projects and now Im trying to connect to mysql docker image but I always get </p> <blockquote> <p>dial tcp 127.0.0.1:3306: connect: connection refused</p> </blockquote> <p>In my old computer everything worked correctly but now I've this problem.</p> <p>My docker compose(Not showing all the content):</p> <pre><code>version: "3" services: mysql: image: mysql:5.6 ports: - "3306:3306" volumes: - mysql-data:/var/lib/mysql - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d environment: MYSQL_ROOT_PASSWORD: a LANG: C.UTF-8 adminer: image: adminer ports: - 8082:8080 nginx: build: ../docker-shared/nginx ports: - 443:443 volumes: - "./nginx_proxy_settings.conf:/etc/nginx/conf.d/nginx_proxy_settings.conf" volumes: mysql-data: </code></pre> <p>So if I do a <code>docker-compose up</code> everything works, you can check in the next image the Adminer is working with data: <a href="https://i.stack.imgur.com/gph2d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gph2d.png" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/yMGRe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yMGRe.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/nKFrY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nKFrY.png" alt="enter image description here"></a></p> <p>This is my Golang code to connect to mysql:</p> <pre><code>func main() { dbConfig := mysql.NewConfig() dbConfig.User = "root" dbConfig.Passwd = "a" dbConfig.Addr = "mysql" dbConfig.DBName = "company_prod" db, err := sql.Open("mysql", dbConfig.FormatDSN()) if err != nil { panic(err) } defer db.Close() } </code></pre> <p>Do you know what Im doing wrong??</p> <p>Thank you</p> </div>

navicat中mysql数据库可以密码连接,但是localhost_3306进不去。

_**我详细__的叙述一下经过:** 首先是一道题:“以user1用户身份登录数据库”,由于不能进入,所以根据别人的CSDN博客文章进行了修改: ![图片说明](https://img-ask.csdn.net/upload/201712/21/1513870487_168004.jpg) 如图所示,当然他的博客中有错误,但是大体正确。 按上述步骤修改完后发现: “原来进入mysql直接命令行敲mysql便好,但是现在必须账号密码输入”,然后直到下面这道题,就出现了如下问题: ![图片说明](https://img-ask.csdn.net/upload/201712/21/1513870561_222521.jpg) 我表示一脸懵逼,因为自己是第一次进行此类操作。。。别急,问题还产生更多: 我发现,“navicat可以在以前的基础上输入root密码可以连接mysql数据库,但是会出现下述问题”: ![图片说明](https://img-ask.csdn.net/upload/201712/21/1513870842_825426.jpg) ![图片说明](https://img-ask.csdn.net/upload/201712/21/1513870854_672595.png) 无助的我,表示更加的懵逼。。。 求大佬解答。

用户'用户名'@'localhost'拒绝访问(使用密码:YES)

<div class="post-text" itemprop="text"> <p>I just recently installed mySQL on my Mac running 10.10.3, but I can't create any tables or modify anything associated with my databases. When I start mysql I logs me in as '@localhost'</p> <pre><code>mysql&gt; select user(); +-----------------------+ | user() | +-----------------------+ | username@localhost | +-----------------------+ 1 row in set (0.00 sec) mysql&gt; select current_user(); +----------------+ | current_user() | +----------------+ | @localhost | +----------------+ 1 row in set (0.00 sec) mysql&gt; CREATE DATABASE ign; ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ign' </code></pre> <p>I even try running this to log into my sql.</p> <pre><code>mysql -u username -p Enter password: ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES) </code></pre> <p>I am so lost and any help would be greatly appreciated. </p> </div>

PHP / Mysql:Connexion与数据库一起使用mysqli,而不是PDO

<div class="post-text" itemprop="text"> <p>I works on a android application, with a PHP server, linked to MySQL.</p> <p>In my PHP server, I try to create a PDO.</p> <pre><code>try{ $pdo = new PDO('mysql:host=localhost;dbname=quiz_android_db','root','****'); } catch (PDOException $e){ echo ('Erreur: ' . $e-&gt;getMessage()); } </code></pre> <p>But each Time, I have this error : </p> <blockquote> <p>Erreur: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)</p> </blockquote> <p>I use the same username and the same password in a mysqli object and it works. Where could be the problem ? </p> <p>I use windows 10, php 5.6.19 , mysql 5.17.11</p> <p>EDIT : This is the way use mysqli </p> <pre><code>$mysqli = new mysqli("localhost","root","****","quiz_android_db"); if ($mysqli-&gt;connect_errno) { echo "Echec lors de la connexion à MySQL : (" . $mysqli-&gt;connect_errno . ") " . $mysqli-&gt;connect_error; return null; } </code></pre> </div>

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

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

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

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

Linux命令学习神器!命令看不懂直接给你解释!

大家都知道,Linux 系统有非常多的命令,而且每个命令又有非常多的用法,想要全部记住所有命令的所有用法,恐怕是一件不可能完成的任务。 一般情况下,我们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个都可以实现我们的目标,但有没有更简便的方式呢? 答案是必须有的!今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势...

和黑客斗争的 6 天!

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

史上最全的 python 基础知识汇总篇,没有比这再全面的了,建议收藏

网友们有福了,小编终于把基础篇的内容全部涉略了一遍,这是一篇关于基础知识的汇总的文章,请朋友们收下,不用客气,不过文章篇幅肯能会有点长,耐心阅读吧爬虫(七十)多进程multiproces...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

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

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

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

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

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

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

新一代神器STM32CubeMonitor介绍、下载、安装和使用教程

关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang最近ST官网悄悄新上线了一款比较强大的工具:STM32CubeMonitor V1.0.0。经过我研究和使用之...

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

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

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

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

大学一路走来,学习互联网全靠这几个网站,最终拿下了一把offer

大佬原来都是这样炼成的

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

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

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

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

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

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

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

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

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

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

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

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

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

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

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

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

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

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

立即提问
相关内容推荐