开发者

create new database on xampp

开发者 https://www.devze.com 2023-04-01 07:45 出处:网络
How can I create new database on xampp on centos 5? When I hot mysql -u root -p in terminal it says no mysql command found. When I go to phpMyAdimn page it do not accepts my username/password. What to

How can I create new database on xampp on centos 5? When I hot mysql -u root -p in terminal it says no mysql command found. When I go to phpMyAdimn page it do not accepts my username/password. What to do in this situation to create new database? Mysql service of xampp is running because when I run "ps ax | grep m开发者_如何学Pythonysql" I can see xampp mysql process.


Symptom: Create new database: No Privileges

Worked for me in "standard" xampp on linux after running /opt/lampp/lampp security:

To add a new database log in to phpmyadmin as user "root" with password as defined for user "pma".


I have to put this in an answer (for the syntax) and it will look like this (in some file called "createDB.php")

You can run it with command-line "php createDB.php", or you can use your browser to set the adress "createDB.php" in your localhost, when you copy your file in the opt/lampp/htdocs folder.

I did not test it but it should work.

<?php
$con = mysql_connect("localhost","louis","abc123");
if (mysql_query("CREATE DATABASE my_db",$con))
    {
    echo "Database created";
    }
?>


As you have indicate mysql process is running. So, try

locate mysql
which mysql
whereis mysql

It could be your login session does not include the actual path to mysql client program.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号