PDA

View Full Version : Setting Up MySQL



FrOzeN89
November 16th, 2007, 05:33 PM
I just got Apache/php working fine and now I want to add MySQL so I can work with it locally. I've installed libapache2-mod-auth-mysql, mysql-admin, and mysql-query-browser. I've never worked with MySQL before except through a CPanel on a website I used to have.

What do I have to do so I can login to MySQL Admin/Query Browser using "localhost"?

Thanks. :)

Kadrus
November 16th, 2007, 05:49 PM
http://ubuntuguide.org/wiki/Ubuntu_dapper

Here's a link...it's a guide..see the SQL part

FrOzeN89
November 16th, 2007, 06:17 PM
Sweet, just followed the guide and it worked perfectly. Thanks! :)

Kadrus
November 16th, 2007, 06:58 PM
Glad to help :)

harakiri1976
November 19th, 2007, 11:13 PM
Hello!


I want to learn mysql but I'm having problems:(
I've followed Dapper's tutorial above and installed all correctly. I've tested my http://localhost/ with a test.php and everything is working fine. I can add .php files to my /var/www/ and accessed them (view them) using Firefox.
The problem is mysql :( I don't know how to use it and How To Start It:( I'll be more specific. If I type mysq and TAB on the Shell you can see what I've have:

Code:

nuno@nuno-desktop:~$ mysql
mysql mysql_fix_extensions
mysqlaccess mysqlimport
mysqladmin mysqlmanager
mysqlbug mysqlreport
mysqlcheck mysqlshow
mysql_client_test mysql_tableinfo
mysql_client_test_embedded mysqltest_embedded
mysqldump mysqltestmanager
mysqldumpslow mysqltestmanagerc
mysql_explain_log mysqltestmanager-pwgen
mysql_find_rows mysql_waitpid

..then, If I try to access mysql I get this error:

Code:


nuno@nuno-desktop:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I don''t know if this is not the way we can start with mysql using command line options. Or, If I need to configure Apache for the mysql to function correctly.
I can see that my /etc/apache2/httpd.conf is an empty file. I don't know if it helps but I've just "sniffed" those files.

Code:


nuno@nuno-desktop:/etc/apache2$ ls
apache2.conf envvars mods-available ports.conf sites-enabled
conf.d httpd.conf mods-enabled sites-available

If you please tell me some possible clues about it.
Thanks!

LaRoza
November 20th, 2007, 12:44 AM
Try:



mysql -uroot -p

harakiri1976
November 20th, 2007, 01:28 AM
LaRoza, thanks!... but same problem :(

code:

nuno@nuno-desktop:/etc/apache2$ mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

LaRoza
November 20th, 2007, 01:49 AM
You have to start it.

harakiri1976
November 20th, 2007, 01:53 AM
LaRoza, I'm sorry!

(stupid me!)

...now, I didn't type any password and I guess I did it!! :)
Now I must learn how to "configure" and use MySQL:)

Thanks!

Code:

nuno@nuno-desktop:/etc/apache2$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.38-Ubuntu_0ubuntu1.1-log Ubuntu 7.04 distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Guess it's working! :)

LaRoza
November 20th, 2007, 01:59 AM
You can type your password right after the -p if you want. Make sure there are no spaces between the p and password.

harakiri1976
November 20th, 2007, 02:10 AM
Hmm didn't work .. the pass!:(


nuno@nuno-desktop:~$ mysql -uroot -p*******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


the ******* being my password...



PS: Love your Python Tutorials/links/page etc etc.

LaRoza
November 20th, 2007, 02:17 AM
Hmm didn't work .. the pass!:(


nuno@nuno-desktop:~$ mysql -uroot -p*******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


the ******* being my password...

PS: Love your Python Tutorials/links/page etc etc.

The password must have been wrong.

Which link do you like? The first one, or the second one? The first is my own wiki, devoted to the learning of many languages on all platforms, the second is pmasiar's wiki, who often posts after me with reference to his own wiki after I recommend mine. My wiki does link to his internally, but I supposed I could save him the time by having a direct link in my sig. Glad it helped, whichever it was!

harakiri1976
November 20th, 2007, 02:27 AM
No. I tried the pass a few times:( There's something there missing...especially my ZERO knowledge in mysql. Anyway, this is a good start :)

Well, I loved both. I realized the 1st one (yours) was generic but It connected me to many Python things. That's Good!

I tried to send you a private message about it but I guess I didn't succeed. I was asking you an advice/tip about Programming the Parallel Port with Python. A guy told asked me that in an Electronics Forum a few days and I couldn't help him. He was trying to make a script to communicate with parallel port and heard that there's a script or a Module in Python already written. Asked me if anyone know. I don't! I searched and realized that there's a lot of people here doing it but in "C". but in Python... :(....hmmm guess not. The guy did some stuff in VBA and it worked well. Now he's using Ubuntu and don't want "to come back" to WINDOWS...lol

I'm collecting stuff, info, about Python. I want to learn! I love Python! It's very Powerfull! And very user friendly:)

LaRoza
November 20th, 2007, 02:33 AM
Well, I loved both. I realized the 1st one (yours) was generic but It connected me to many Python things. That's Good!

I'm collecting stuff, info, about Python. I want to learn! I love Python! It's very Powerfull! And very user friendly:)

What happened to the private message? Did you get an error?

My wiki does have more for Python than most of the other languages, but I hope to balance it out. I am considering adding C#, but am unsure of it.

Just between us, mine is better than the other one. :-)

I hope my wiki has enough Python on it for you...

harakiri1976
November 20th, 2007, 02:38 AM
lol...Yeah! Yours is Good! :)

No, I didn't get any error. But I don't see the Sent Message in my profile. So I am not sure the message was sent :( It's no big deal. I was just asking if you know about the parallel port to send me a Tip.

I collected a lot of Python Books. Dive into Python is very Good! And "Beginning Python from Novice to Professional" from Apress is a very good one too ;)

LaRoza
November 20th, 2007, 02:40 AM
Sorry, I don't know anything on that topic.

I save the sites and books to my hard disk, so I have a large local collection now. It helps that the Python site gives the complete documentation and everything else as a single download, most useful.

-EDIT Did you see the Python and MySQL section? It may interest you.

harakiri1976
November 20th, 2007, 02:44 AM
Ok Thank You anyway ;)

I saw your opinion in my threads about being PRO Python. And as I am "starting" it was nice to hear your opinions and other people's opinion.

I did very small (tries) scripts in Python using Windows a long time ago. But I gave up because I hadn't time. :S Now I'm pretending to start from scratch ;)


Best Regards!


and... Thanks! ;)

LaRoza
November 20th, 2007, 05:04 AM
Ok Thank You anyway ;)

I saw your opinion in my threads about being PRO Python. And as I am "starting" it was nice to hear your opinions and other people's opinion.

I did very small (tries) scripts in Python using Windows a long time ago. But I gave up because I hadn't time. :S Now I'm pretending to start from scratch ;)

Best Regards!


http://pyserial.sourceforge.net/pyparallel.html

Found it!

By the way, you sent an email, not a personal message.

harakiri1976
November 20th, 2007, 06:53 PM
LaRoza, you're right! :)

Thanks man! ;)


PS: Ty for the pyParallel link :)