Ubuntu Service not connected to MySQL, how to solve
Source: Internet
Author: User
Ubuntu service not even on MySQL
With Ubuntu service 12.04 version, Apache install no problem, Web page can be accessed, MySQL server can be accessed by command. But using the following database connection code is not possible. What's going on here.
Did not jump out of the error prompt
$con = mysql_connect ("localhost", "root", "123");
if (! $con)
{
Die (' Could not connect: '. Mysql_error ());
}
$db _selected = mysql_select_db (' buy ', $con);
if (! $db _selected)
{
Die ("can\-t use test_db:". Mysql_error ());
}
------Solution--------------------
$con = mysql_connect ("127.0.0.1", "root", "123"); Can I link it? It is most likely a permissions issue.
How do you link MySQL to Ubuntu?
$ mysql-h localhost-u root-p;?
"Show grants" to see what to return?
What does "Select User, host from Mysql.user" return?
------Solution--------------------
What do you mean, no? What is the error message?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service