457,726 Members | 1,217 Online
Need help? Post your question and get tips & solutions from a community of 457,726 IT Pros & Developers. It's quick & easy.

 P: n/a Hello. I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running locally with Apache 1.3.27 on Windows XP Pro. I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my copy of MySQL. When I do this however it gives me an error message saying: Error 1044 Access denied for user: '@localhost' to database 'newland_tours' and numerous other ones saying: Error 1046 No Database Selected If you can help me I'd be very grateful. I think that something must be wrong or amiss with the settings or the paths to the files in my.ini file? Or perhaps it is just a bug with php or MySql? Thanks very much for any help John Jul 17 '05 #1
10 Replies

 P: n/a John wrote: I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my copy of MySQL. When I do this however it gives me an error message saying: Error 1044 Access denied for user: '@localhost' to database 'newland_tours' Make sure that the correct user is defined in mysql and supply it, e.g.: path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql For more info on priveleges, see: http://dev.mysql.com/doc/mysql/en/De...rivileges.html and http://dev.mysql.com/doc/mysql/en/GRANT.html JW Jul 17 '05 #2

 P: n/a On Sat, 05 Jun 2004 20:59:00 GMT, "Janwillem Borleffs" wrote: John wrote: I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my copy of MySQL. When I do this however it gives me an error message saying: Error 1044 Access denied for user: '@localhost' to database 'newland_tours'Make sure that the correct user is defined in mysql and supply it, e.g.:path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql How exactly do I define correct user and supply it? When I go to the mysql> prompt do I type in what you have put? path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql I understand everything here: path\to\mysql-installation\bin\mysql but I don't have a clue about this: -uroot -prootpasswd < For more info on priveleges, see:http://dev.mysql.com/doc/mysql/en/De...rivileges.html andhttp://dev.mysql.com/doc/mysql/en/GRANT.html I have taken a look at these links and all the different sections and subsections, but it is far too complex for me. I am just a beginner. I need it explained simply what to do. Cheers John Jul 17 '05 #3

 P: n/a "John" wrote in message news:gb********************************@4ax.com... On Sat, 05 Jun 2004 20:59:00 GMT, "Janwillem Borleffs" wrote:John wrote: I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my copy of MySQL. When I do this however it gives me an error message saying: Error 1044 Access denied for user: '@localhost' to database 'newland_tours'Make sure that the correct user is defined in mysql and supply it, e.g.:path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql How exactly do I define correct user and supply it? When I go to the mysql> prompt do I type in what you have put? path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql I understand everything here: path\to\mysql-installation\bin\mysql but I don't have a clue about this: -uroot -prootpasswd

 P: n/a In article , John wrote: On Sat, 05 Jun 2004 20:59:00 GMT, "Janwillem Borleffs" wrote:John wrote: I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my copy of MySQL. When I do this however it gives me an error message saying: Error 1044 Access denied for user: '@localhost' to database 'newland_tours'Make sure that the correct user is defined in mysql and supply it, e.g.:path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql How exactly do I define correct user and supply it? When I go to the mysql> prompt do I type in what you have put? path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql I understand everything here: path\to\mysql-installation\bin\mysql but I don't have a clue about this: -uroot -prootpasswd

 P: n/a On Sat, 05 Jun 2004 22:59:01 -0700, "Michael Vilain " wrote: Buy a book on MySQL and read it. It's whole other rathole in additionto php. You'll need to understand what a real DBMS is doing and how itdoes it. It's not trivial. Be ready for your brain to turn to tapiocaand leak out your ears. I already have two books. John Jul 17 '05 #7

 P: n/a Sounds like theres not telling it what user to use - if you haven't set on up you should be able to use the root user (root@localhost) - as an aside why not just use easyPHP to set up mysql/apache - it take five minutes??) Jul 17 '05 #10

 P: n/a Hey there. I just started subscribing to some php news-lists, and this was the one looking the closest to what I was hoping to find when venturing out on my local news-server. As I am fairly new in the world of PHP scripting, I would like to know if any of you would be so kind to give me some suggestions on my current project. It's called Squid-Switcher (a stripped down version of it is available and is called VHost-List). One of my current topics of self-discussion is security, features to come and... right... this array problem I have been unable to figure out how to solve. All my code is released under the GNU GPL license, so do with it what you will, as long as you're sharing it to the rest of the world :) Here is the code to Squid-Switcher 0.2.4 who's main purpose is to present a web front end for users, allowing them to change the outgoing IP on a Squid proxy server without having to edit any files, figure out what IP's are available at the machine and resolving them to see which ones are up or down. Any improvements to my half-descent code is welcomed, as long as you share it with the rest of us! A working demo could be seen at http://sokaris.yi.se/squid-switcher/ , but that host has gone down... but thats another story.... for more of my little projects, check out http://sobek.yi.se/projects/web_code/ For more info about me, check out http://erik.yi.se. This code is my way of saying hello! :) // Erik Söderström ";?> Squid - Switcher[by: Erik Söderström] ";?> 255) die('You entered a non valid IP.'); $replace = 'tcp_outgoing_address ' .$newip; $sContent = implode('', file($sqconf)); $ptrn = '/tcp_outgoing_address 205\.217\.166\.(\d{1,3})/';$contents = preg_replace($ptrn,$replace, $sContent); if ($fd = @fopen($sqconf, "w")) { if (!@fwrite($fd, $contents)) { echo "Error writing to file"; } fclose($fd); } else { die("Could not open $filename for reading and writing"); } }$spid = file_get_contents($sqpid); exec("kill -HUP ".$spid); } function file_get_contents($filename) {$fd = fopen("$filename", "rb");$content = fread($fd, filesize($filename)); fclose($fd); return$content; } function writefile($filename,$data, $mode) {$fp = fopen($filename,$mode); fwrite($fp,$data); fclose($fp); } //$ptrn = '/tcp_outgoing_address 205\.217\.166\.(\d{1,3})/'; $ptrn = preg_replace('/(\^|\$|\/)/', '', $findpattern); preg_match_all('/('.$ptrn.')/', file_get_contents($squidconf),$ipad[][$current]); echo "» Squid-Switcher 0.2.4 (update list) (read log) (view source) (go back) "; if (!isset($use)) { if ($action == "readlog") { echo " Logfile contents: "; include($log_file); echo "
"; } elseif($action == "viewsource") { echo " Sourcecode of ".basename($_SERVER["PHP_SELF"])."

"; show_source(basename($_SERVER["PHP_SELF"])); } else { echo "» Current active hostname: ". @ gethostbyaddr($ipad[0][$current])." (".$ipad[0][$current].") "; echo " STATUS:IP: HOSTNAME:$status$ip$hostname
STATUS:IP: HOSTNAME:
"; if ($action == "update") { if ($logging == "true") { writefile($log_file,"[".$time."] (".$remoteuser."): USER tried to update vhosts-file.\n", "a"); }$endip++; for ($i =$startip; $i <$endip; $i++) {$ipvect[] = $ipserie.$i; } writefile($vhosts_file_tmp, "", "w"); for ($i = 0; $i < count($ipvect); $i++) {$ip = $ipvect[$i]; $hostname = @gethostbyaddr($ip); $iprev = @gethostbyname($hostname); if ($hostname ==$ip) { $hostname = "This IP is not reversed.";$status = "DOWN"; } else { if ($iprev !=$ip) { $status = "DOWN"; } else { if ($iprev == $ip) {$status = "UP"; } else { $status = "ERROR"; } } } if ($chrlimit == "true") { if (strlen($hostname) >$chrlength) $hostname = substr($hostname, 0, $chrlength)."..."; }$output = "\n"; echo $output; writefile($vhosts_file_tmp, $output, "a"); } writefile($vhosts_file_tmp,"", "a"); writefile($log_file,"[".$time."] (".$remoteuser."): Vhost-file update attempt succesfull!\n", "a"); unlink($vhosts_file); rename($vhosts_file_tmp,$vhosts_file); } else { include($vhosts_file); } } } if ((isset($use)) && ($action == "activate")) { modconf($findpattern, $use,$squidconf, $squidpid); if ($logging == "true") { writefile($log_file,"[".$time."] (".$remoteuser."): Changed FROM - ".$ipad[0][$current]." (". @ gethostbyaddr($ipad[0][$current]).") - TO - ".$use." (". @ gethostbyaddr($use).")\n", "a"); } echo "» Current active hostname: ". @ gethostbyaddr($use)." (".$use.") "; echo ""; include($vhosts_file); } ?> Jul 17 '05 #11

### This discussion thread is closed

Replies have been disabled for this discussion.