Installing Mysql

Hello,

I am really new to this so im hoping this is the place to get some help! I need to install mysql on my server. Previous servers I had already had everything set up for me…

81 Replies

You'll do this through the package manager for your distribution. If you tell us what your distribution is (Debian, CentOS, etc) then we can help.

Also I'd recommend Googling for a general guide on how to manage that distribution; that will answer this and many other questions.

Hey ! I have Ubuntu 9.04 please let me know any other info that you need Thank you!

Take a look at this:

http://doc.ubuntu.com/ubuntu/serverguide/C/

Specifically, chapter 3:

http://doc.ubuntu.com/ubuntu/serverguid … ement.html">http://doc.ubuntu.com/ubuntu/serverguide/C/package-management.html

To answer your question, you probably want to run: aptitude install mysql-server

this may sound like dumb question but how do i execute that code? Do i need to install something? I watched the getting started movie and at the end i saw him logging on with something that looked like terminal… Im really sorry im probably making you giggle right now… Im just clueless but i want to learn!

Quick Start Guide

1. If you're on Windows, download PuTTY or something like that.

2. Run PuTTY.

3. Type in your linode's IP address (which you can find in the "Network" tab of Linode Manager) and hit Enter.

4. That'll drop you into your linode's shell (terminal).

5. Log in as "root" using the password you set up when you deployed your Linux distribution.

6. Now you can start typing away other commands.

Or alternatively, you can find a web-based shell in the "Console" tab of Linode Manager. It's called LISH. The web-based shell tends to break some screen layouts, though.

Quick Apache + PHP + MySQL setup:

apt-get update
apt-get upgrade
apt-get install apache2 php5 php5-mysql mysql-server mysql-client

(You can replace apt-get with aptitude)

Edit: What he said. ↑

In your management console (on the Linode site), click the Networking tab. You'll then see the external IP address of your node. To get a terminal prompt, use a program like Putty (assuming you're on Windows) to connect to that address.

Unfortunately I'm not sure what the correct username and password are for a default Ubuntu install on Linode.

if im on a mac can i just run terminal ?

You get to a terminal, and then run: ssh [ip address]

WOW I think I DID IT! this is sooo awesome!!! so how do i tell if it installed correctly? is there an interface?

You can check the status of a running MySQL daemon with the command mysqladmin status. If MySQL is not running, you can start it with /etc/init.d/mysql start.

As far as interface, you can use the basic client programs, or a nice web-based interface is phpMyAdmin. Search around for tutorials, as there's not enough space in this little textbox to walk you through the details of setting up a database.

Thanks for all ur help I intend on reading alot more about this.. my problem right now is time I need to get all this information that is on one server to here before tomorrow night… or ill lose everything… wen i type in that command it says

"mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

"

That means MySQL is not running. If it were, you'd see something like

Uptime: 2179002  Threads: 1  Questions: 6096795  Slow queries: 214
Opens: 4611  Flush tables: 1  Open tables: 64  Queries per second avg: 2.798

is there anyone who would be willing to move things over to this new server from my old one? I need it done by tomorrow I am willing to pay.. Im just afraid I wont be able to figure all this out in time.

Actually, I think its running, otherwise there'd be no response from MySQL…that's a response from the MySQL server.

The way I'm reading that is that the root account has a password but it wasn't supplied by the user, which is why the error says, "(Using password: NO)"

Christina, try using the -p option and it should ask you for a password. If it doesn't post your command and options, please.

okay so I think its working … i got

"root@li65-162:~# /etc/init.d/mysql start

  • Starting MySQL database server mysqld

…done."

Im not really sure what to google to get more info… you guys have been so awesome in helping me out thank you!!! I cant wait to read up and learn more…

Right now I have backup files ( that the old developer gave to me from the old server) they are .sql how would I go about getting the back up files into my new mysql?

does this look like a good one? http://www.linuxhelp.net/guides/mysql/

I just dont want to do something that im not suppose to be

Easy way

1. apt-get install phpmyadmin

2. Point your browser at http://your.ip.address/phpmyadmin

3. Log in as root + MySQL root password (not your SSH root password, though they may be the same)

4. Create a databse

5. Go to "privileges", add a user, give the user access to the database

6. Log out of phpmyadmin and try to log back in as newly created user

7. Select the database

8. Go to "import" and just upload the .sql file!

http://97.107.135.162/phpmyadmin

getting an error

Do you have a webserver setup and running?

http://97.107.135.162/

I can't connect to it from 3 different locations.

Yes I believe so. I can access my server via ftp

But you, well I, can't access your site from a browser, so I'd say you either don't have a web server installed or it's not running.

Have you installed Apache, Lighttpd, or ngix?

What's the error message you get when you try to access your site with a web browser?

this is the message that I get

Firefox can't establish a connection to the server at 97.107.135.162.

Im kind of confused ( and im sorry) about when u say install… do i upload the files to my server? do i write a command in the terminal? I thought I had mysql running but i guess not.. thanks for being patient with me :oops:

okay so im using Aptitude now is there somewhere in there that i can install mysql?

@christina:

root@li65-162:~# /etc/init.d/mysql start

  • Starting MySQL database server mysqld

…done."
Mysql is installed and running – you just need a web server if you want to upload data via a browser & phpmyadmin.

Have you followed hybinet's suggestions, above ?

Cheers.

you mean this

Easy way

1. apt-get install phpmyadmin

2. Point your browser at http://your.ip.address/phpmyadmin

3. Log in as root + MySQL root password (not your SSH root password, though they may be the same)

4. Create a databse

5. Go to "privileges", add a user, give the user access to the database

6. Log out of phpmyadmin and try to log back in as newly created user

7. Select the database

8. Go to "import" and just upload the .sql file!

When i go to http://97.107.135.162/phpmyadmin im just getting an error saying that i cant connect…

okay i did a few things but now im getting this Not Found

The requested URL /phpmyadmin was not found on this server.

Apache/2.2.11 (Ubuntu) Server at 97.107.135.162 Port 80

Check that there is a link to phpmyadmin in /var/www/

ls -l  /var/www

Did apititude offer to configure Apache for you, when you installed it ? Nonetheless, restart apache just in case you installed them in an odd order:````
/etc/init.d/apache2 restart

Edit: Actually, I'm guessing that you probably didn't let Aptitude auto configure phpmyadmin. To do it again:````
dpkg-reconfigure phpmyadmin

– and make sure Apache is selected (has a dot in the box -- use the space bar), then press tab to a few times to select the OK button, then press enter.

I dont believe if offerend me to no…

this is what i get when i type that command

root@li65-162:~# ls -l /var/www

total 4

-rw-r--r-- 1 root root 45 May 28 21:52 index.html

See above to reconfigure it (dpkg-reconfigure phpymadmin), else create the symlink manually:

ln -s /usr/share/phpmyadmin/index.php /var/www/phpmyadmin

okay well now its saying Im forbidden… which is a guess a step ! hahah at least something is there

Edit: Actually, I'm guessing that you probably didn't let Aptitude auto configure phpmyadmin. To do it again:

Code:

dpkg-reconfigure phpmyadmin

– and make sure Apache is selected (has a dot in the box -- use the space bar), then press tab to a few times to select the OK button, then press enter.

Im working on a mac via terminal… im not sure what you mean when u say i should be able to select things

Check that you have "Options FollowSymLinks" in /etc/apache2/sites-available/default, i.e. something similar to:

more /etc/apache2/sites-available/default

 <directory var="" www="">.
    Options Indexes FollowSymLinks MultiViews
    .
    .</directory> 

ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks

AllowOverride None

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Order allow,deny

Allow from all

ErrorLog /var/log/apache2/error.log

Possible values include: debug, info, notice, warn, error, crit,

alert, emerg.

LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

Allow from 127.0.0.0/255.0.0.0 ::1/128

Im not sure what that mean… but thats what it said

anyone have anymore suggestions ?

Troubleshooting permissions can be a slow process over forums. ;)

When you run the following, are you asked any questions ? dpkg-reconfigure -plow phpmyadmin

this is what confuses me

Package `phpmyadmin' is not installed and no info is available.

Use dpkg –info (= dpkg-deb --info) to examine archive files,

and dpkg --contents (= dpkg-deb --contents) to list their contents.

/usr/sbin/dpkg-reconfigure: phpmyadmin is not installed

its saying phpmyadmin is not installed… When I log on to my server with an ftp I only see 2 folders 1) .aptitude 2).debtags

should I be downloading and uploading things to my server to get mysql to work?

@christina:

this is what confuses me

Package `phpmyadmin' is not installed and no info is available.

Use dpkg –info (= dpkg-deb --info) to examine archive files,

and dpkg --contents (= dpkg-deb --contents) to list their contents.

/usr/sbin/dpkg-reconfigure: phpmyadmin is not installed

its saying phpmyadmin is not installed… When I log on to my server with an ftp I only see 2 folders 1) .aptitude 2).debtags

should I be downloading and uploading things to my server to get mysql to work?

Mysql is installed, see above. Packages aren't normally installed into your home directory, so don't worry about the lack of folders present (maybe grab a good book on *nix when you have time :))

Did you run through hybinet's suggestions, above ? (If so, you should have had phpymadmin installed). Anyway, for whatever reason it's not present, so go ahead and install it: apt-get update && apt-get install phpmyadmin

hey this is what comes back

Hit http://security.ubuntu.com jaunty-security Release.gpg

Hit http://us.archive.ubuntu.com jaunty Release.gpg

Hit http://security.ubuntu.com jaunty-security Release

Hit http://us.archive.ubuntu.com jaunty Release

Hit http://security.ubuntu.com jaunty-security/main Packages

Hit http://us.archive.ubuntu.com jaunty/main Packages

Hit http://security.ubuntu.com jaunty-security/restricted Packages

Hit http://security.ubuntu.com jaunty-security/main Sources

Hit http://us.archive.ubuntu.com jaunty/restricted Packages

Hit http://us.archive.ubuntu.com jaunty/main Sources

Hit http://security.ubuntu.com jaunty-security/restricted Sources

Hit http://us.archive.ubuntu.com jaunty/restricted Sources

Reading package lists… Done

Reading package lists… Done

Building dependency tree

Reading state information… Done

E: Couldn't find package phpmyadmin

root@li65-162:~#

I am def going to read up on this stuff but my problem now is I have a server that just shit down at 5pm. I need to put the site back up asap… thats why i was posting and trying to figure it out. I want to figure it out but is anyone interested in spending some time on this with me or alone and I will be more then happy to compensate you…

We should be nearly there. :)

You need to enable the Universe repository for ubuntu:````
nano /etc/apt/sources.list

Use the down arrow to scroll to the bottom, and find the line that looks something like:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty main

Add the word "universe" to the end, so that it becomes:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty main universe
````
1. Press CTRL-o (the letter o) and enter, to write the file.

2. Press CTRL-x to exit.

3. Now re-run the apt-get update && apt-get install phpmyadmin command from above.

i cant thank you enough for still hanging in there to help me out…

when you code I take that and the paste it in terminal… is that correct? I just get alittle confused when u say scroll down and change stuff bc i have very few options with terminal…

also when i put in the first line of code it says this

root@li65-162:~# nano/etc/apt/sources.list

-bash: nano/etc/apt/sources.list: No such file or directory

No worries.

@christina:

nano/etc/apt/sources.list

-bash: nano/etc/apt/sources.list: No such file or directory You need a space between "nano" and /etc/apt/sources.list. To paraphrase, "using the editor called "nano", open the file called /etc/apt/sources.list". Without the space, it's just one long, non-existant command.

Within the terminal, you should be able to scroll up and down within the file (when editing with nano) using the arrow keys on your macbook.

hey i dont see deb http://us.archive.ubuntu.com/ubuntu/ jaunty main and i even do a search for it and it says its not there…. there is nothing there .![](" />

Get rid of the dot at the end of sources.list. and rerun the command.

wow haha okay this is what comes up

main & restricted repositories

deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted

deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted

deb http://security.ubuntu.com/ubuntu jaunty-security main restricted

deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted

universe repositories

deb http://us.archive.ubuntu.com/ubuntu/ jaunty universe

deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty universe

deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates universe

deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty-updates universe

deb http://security.ubuntu.com/ubuntu jaunty-security universe

deb-src http://security.ubuntu.com/ubuntu jaunty-security universe

should I change the top one?

Just remove the # from the beginning of these two lines:

@christina:

(first line after ## universe repositories)

deb http://us.archive.ubuntu.com/ubuntu/ jaunty universe

(second to last line)

deb http://security.ubuntu.com/ubuntu jaunty-security universe

Ah…. in that case, just remove the # sign from the last six lines.

Then

apt-get update

apt-get install phpmyadmin

oops… mjrich was quicker

Anyway, when phpmyadmin is up and running, you can follow my instructions in the previous page.

The upload your website files to /var/www

(Edit the file containing database settings, if necessary)

Good luck :D

… and don't forget to add some sort of security to phpmyadmin :).

An .htaccess file at the very least (and preferably install an SSL cert as well).

WOW that was pretty cool!!!! what was that file?

http://97.107.135.162/phpmyadmin

does it look like I did everything correctly?

@christina:

WOW that was pretty cool!!!! what was that file?

http://97.107.135.162/phpmyadmin

does it look like I did everything correctly?

That's the raw php. For some reason, your php processor's not doing what it should. I'd restart Apache (though apt should have done this anyway):

/etc/init.d/apache2 restart

OKay i did that but I am still seeing a raw php file… mhhh

What about

apt-get install php5

/etc/init.d/apache2 restart

Apache seems to think php's there though, e.g.

GET http://97.107.135.162/foo | grep -i php

Odd.

That's strange. Let's run a simple test to see what's going on.

nano /var/www/index.php

Put the following line in it, and save.

Point your browser at

http://97.107.135.162/

Do you see the text you just entered, or do you see a lot of other stuff in colorful tables?

If the test fails and you just see the one line, try adding the following to /etc/apache2/sites-available/default

(If the previous test succeeds and you see colorful tables, you must not do this.)

AddType text/html .php .phps

AddHandler application/x-httpd-php .php

AddHandler application/x-httpd-php-source .phps

You can put it anywhere you want, but the best location is probably just before the ScriptAlias stuff.

Now restart apache…

/etc/init.d/apache2 restart

Cross your fingers & try again.

okay yeah the first thing didnt work so I will try the other

root@li65-162:~# /etc/apache2/sites-available/default

-bash: /etc/apache2/sites-available/default: Permission denied

nano /etc/apache2/sites-available/default

Sorry about that, should have included nano 8)

This is still very strange. Last time I checked, Ubuntu could install and configure Apache2 and mod_php all at the same time and make the whole thing ready to go.

its no problem!! Im just thankful youre helping me out you have no idea!!! I did the 2nd test and still dont see any difference.

Oops…….

I gotta go now, but let's try one last thing before someone else can suggest better.

Reinstall the whole LAMP stack!

apt-get purge apache2

rm -rf /etc/apache2

apt-get install --reinstall apache2 libapache2-mod-php5 php5 php5-mysql mysql-server mysql-client phpmyadmin

*** WARNING: ucf was run from a maintainer script that uses debconf, but

the script did not pass –debconf-ok to ucf. The maintainer

script should be fixed to not stop debconf before calling ucf,

and pass it this parameter. For now, ucf will revert to using

old-style, non-debconf prompting. Ugh!

Please inform the package maintainer about this problem.

Replacing config file /etc/phpmyadmin/config-db.php with new version

dbconfig-common: flushing administrative password

Im really at a lose… I thought i was just getting parts of it and now I have no clue why the php looks like that Im assuming its an issue with Apache ?

Must agree, this is all rather odd.

You could also try to update your entire distro first: apt-get update && apt-get dist-upgrade

Followed by hybinet's suggestion to reinstall the entire LAMP stack.

Okay, let's step back a little bit. You want to set up an environment that works pretty much like a shared host, and you need it quick, right?

Then let's stop trying to troubleshoot configuration files by hand and let's install a decent control panel.

Shut down your linode, shrink the disk image with which you've been working, and create a new Ubuntu 9.04 image. Yes, we're starting fresh.

http://ispconfig.org/documentation.htm

Choose Ubuntu 9.04.

Skip the first two pages, because Ubuntu is already installed for you. Start with page 3, number 7.

Just copy & paste from the tutorial, step by step, changing a few numbers as necessary (such as IP addresses)

Whenever it says vi something, replace the vi with nano. Vi is a text editor which isn't particularly n00b-friendly.

See if you have better luck with a more detailed tutorial like this.

will I be given a new Ip address?

No – it'll stay the same.

UGH idk if its just because I have been starting at this all day but im trying to connect to terminal and im getting this error @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)!

It is also possible that the RSA host key has just been changed.

The fingerprint for the RSA key sent by the remote host is

93:a6:62:45:bf:e1:ec:57:6e:19:ab:b5:ec:20:a4:e2.

Please contact your system administrator.

Add correct host key in /Users/newowner/.ssh/known_hosts to get rid of this message.

Offending key in /Users/newowner/.ssh/known_hosts:9

RSA host key for 97.107.135.162 has changed and you have requested strict checking.

Host key verification failed.

[Process exited - exit code 255]

If this is after you've created the new Ubuntu 9.04 image, then that's fine. It just means that the SSH keys have been created anew in your server (which is to be expected), and your Macbook is still expecting to be using the old keypair.

Just open /Users/newowner/.ssh/known_hosts and either delete all of the lines there (if you haven't used SSH for any other server), or just line 9, if you do want to keep the other entries.

If you haven't yet installed your new image, then it's possible something ill is happening; but don't worry, as it's all about to be wiped anyway.

hey mjrich I did install the new image where do I go to whip those lines out the dashboard?

Do you mean the RSA key errors ?

On your macbook (your new ubuntu image is fine). Just open up the file /Users/newowner/.ssh/known_hosts with your editor of choice.

There should be a file on my mac book?

never mind I figured it out… sorry for the silly questions

Hey okay so Im following that tutorial and Im doing pretty good but I just got this error

root@li65-162:~# apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 rkhunter binutils

Reading package lists… Done

Building dependency tree

Reading state information… Done

postfix is already the newest version.

postfix-mysql is already the newest version.

postfix-doc is already the newest version.

mysql-client is already the newest version.

mysql-server is already the newest version.

E: Couldn't find package courier-authdaemon

OKay another question

How do you edit or comment out… The tutorial asked me to do this

and im not sure how to comment it out… are there special key strokes?

We want MySQL to listen on all interfaces, not just localhost, therefore we edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1:

vi /etc/mysql/my.cnf

[…]

Instead of skip-networking the default is now to listen only on

localhost which is more compatible and is not less secure.

bind-address = 127.0.0.1

[…]

To comment out, add a # sign at the beginning of the line.

Example:````

Instead of skip-networking the default is now to listen only on

localhost which is more compatible and is not less secure.

bind-address = 127.0.0.1

````

Those 3 lines are commented out and the program ignores them when reading the configuration file.

okay got that thanks! how do i save the file though? once i enter in "vi /etc/mysql/my.cnf" it brings it up then I comment out that one line… then is says to restart mysql "/etc/init.d/mysql restart" but idk how to get out of that section and run that.

Im also getting alot of erroe saying that packages I want to install cant be installed ex

root@li65-162:~# apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl

Reading package lists… Done

Building dependency tree

Reading state information… Done

Package zoo is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source

E: Package zoo has no installation candidate

am i doing something wrong?

Im about to give up After doing all of that Im still back to where I was before

http://97.107.135.162/phpmyadmin :oops:

AHH YEA I GOT IT. The problem was such a stupid one… I didnt have an * in the box next to Apache i just had the dot… wow. Thanks you guys for helping me so much! YOURE AWESOME! Ill let you know how it goes :) thanks so much!

Glad it worked out.

Just for your information, when you're following a tutorial and it tells you to install things and you get an error such as "Can't find package XXX" or "YYY has no install candidate", just remove the XXX or YYY from the command and try again. This usually happens when you don't have all the repositories enabled, or if there are subtle changes between software versions that the author of the tutorial overlooked. Nothing to worry about.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct