Home Database Mysql Tutorial 一次数据库连接提示权限的问题

一次数据库连接提示权限的问题

Jun 07, 2016 pm 05:30 PM
address message Database Connectivity username Configuration file

这次有点难搞,由于第一次使用nginx和php的php-fpm,mysql也是使用第三方修改过mysql(http://www.percona.com/这是增强版的mysql,一个dba推荐给我),所以觉得

这次有点难搞,由于第一次使用nginx和php的php-fpm,mysql也是使用第三方修改过mysql( 这是增强版的mysql,一个dba推荐给我 ),所以觉得有点难搞,首先就是去检查数据库用户是否远程登录,于是登录mysql,,发现的确是不允许远程登录到mysql,然

GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

后就授权远程登录依然执行程序时依然是拒绝,然后我就怀疑是否与php-fpm执行用户有关,于是又去看了一遍php-fpm的配置文件,没有看到有配置用户或者权限,真是蛋疼,然后又把关的日志文件都翻了一次,没有任何记录,

more /var/log/message #系统级别的 more /var/log/mysql #mysql的这里倒是有一条说这台机器不能解释名称或者服务未知的,难以理解 #2014-04-08 22:46:45 5044 [Warning] IP address '183.29.144.92' could not be resolved: Name or service not known 接着去查看 /etc/hosts #localhost 解释没有问题 more /usr/local/php/var/log #php的没有错误的报告

后来干脆就直接写个简单mysql函数测试能不能连接数据库,结果是连接上了,可是不能明白,我之前的程序不可以,于是打开程序mysql配置文件,发现是使用localhost作为主机地址的,所以连接不了数据库,于是又返回到mysql的用户表中查看主机与用户名的对应关系,原来是主机与用户对应关系不一致


mysql> select User,Host from user; +-------+-----------+ | User | Host | +-------+-----------+ | root | % | | zhuan | % | | root | 127.0.0.1 | | root | ::1 | | | cloud | | root | cloud | | | localhost | | root | localhost | +-------+-----------+ 8 rows in set (0.00 sec)


本文出自 “Freax” 博客,请务必保留此出处

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? Apr 11, 2024 am 09:10 AM

When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

Where is the win10 user profile? How to set the user profile in Win10 Where is the win10 user profile? How to set the user profile in Win10 Jun 25, 2024 pm 05:55 PM

Recently, many Win10 system users want to change the user profile, but they don’t know how to do it. This article will show you how to set the user profile in Win10 system! How to set up user profile in Win10 1. First, press the "Win+I" keys to open the settings interface, and click to enter the "System" settings. 2. Then, in the opened interface, click "About" on the left, then find and click "Advanced System Settings". 3. Then, in the pop-up window, switch to the "" option bar and click "User Configuration" below.

How to fill in the user name of Railway 12306 How to fill in the user name of Railway 12306 Feb 23, 2024 pm 04:07 PM

How to fill in the user name of Railway 12306? You can fill in the user name in Railway 12306 APP, but most friends don’t know how to fill in the user name of Railway 12306. Next is the graphic tutorial on how to fill in the user name of Railway 12306 brought by the editor. , interested users come and take a look! Railway 12306 usage tutorial How to fill in the Railway 12306 username 1. First open the Railway 12306 APP and click [Register] at the bottom of the main page; 2. Then on the registration function page, enter the user name, password, confirmation password, etc.; 3. Finally enter Once completed, you can fill in the user registration.

How to change username in Google Chrome How to change username in Google Chrome Apr 07, 2024 pm 02:40 PM

How to change username in Google Chrome? Nowadays, more and more people like to use Google Chrome. This browser can provide users with rich functions and services. Users can experience all the functions after logging in to their account. Many users just pick one when creating an account. Nickname, I believe everyone wants to know how to change the username later. This article will introduce to you the steps to quickly change your username on Google Chrome. You may wish to take a look and learn more. Introduction to the steps to quickly change the username in Google Chrome 1. In the first step, after we open Google Chrome, open the three vertical dot icons in the upper right corner of the page (as shown in the picture). 2. In the second step, after opening the three vertical dots icon, we click to open the "Settings" option in the menu list (as shown in the figure)

Advanced PHP database connections: transactions, locks, and concurrency control Advanced PHP database connections: transactions, locks, and concurrency control Jun 01, 2024 am 11:43 AM

Advanced PHP database connections involve transactions, locks, and concurrency control to ensure data integrity and avoid errors. A transaction is an atomic unit of a set of operations, managed through the beginTransaction(), commit(), and rollback() methods. Locks prevent simultaneous access to data via PDO::LOCK_SHARED and PDO::LOCK_EXCLUSIVE. Concurrency control coordinates access to multiple transactions through MySQL isolation levels (read uncommitted, read committed, repeatable read, serialized). In practical applications, transactions, locks and concurrency control are used for product inventory management on shopping websites to ensure data integrity and avoid inventory problems.

Effective method to solve the problem of garbled characters in the eclipse editor Effective method to solve the problem of garbled characters in the eclipse editor Jan 04, 2024 pm 06:56 PM

An effective method to solve the garbled problem of eclipse requires specific code examples. In recent years, with the rapid development of software development, eclipse, as one of the most popular integrated development environments, has provided convenience and efficiency to many developers. However, you may encounter garbled code problems when using eclipse, which brings trouble to project development and code reading. This article will introduce some effective methods to solve the problem of garbled characters in Eclipse and provide specific code examples. Modify eclipse file encoding settings: in eclip

Install Helm on Ubuntu Install Helm on Ubuntu Mar 20, 2024 pm 06:41 PM

Helm is an important component of Kubernetes that simplifies the deployment of Kubernetes applications by bundling configuration files into a package called HelmChart. This approach makes updating a single configuration file more convenient than modifying multiple files. With Helm, users can easily deploy Kubernetes applications, simplifying the entire deployment process and improving efficiency. In this guide, I'll cover different ways to implement Helm on Ubuntu. Please note: The commands in the following guide apply to Ubuntu 22.04 as well as all Ubuntu versions and Debian-based distributions. These commands are tested and should work correctly on your system. in U

Why does my PHP database connection fail? Why does my PHP database connection fail? Jun 05, 2024 pm 07:55 PM

Reasons for a PHP database connection failure include: the database server is not running, incorrect hostname or port, incorrect database credentials, or lack of appropriate permissions. Solutions include: starting the server, checking the hostname and port, verifying credentials, modifying permissions, and adjusting firewall settings.

See all articles