8

I am going to learn mysql by myself, so I would like to install mysql on . But there are many applications related to mysql in synaptics. I was wondering what are some basic applications to be installed?

Consider these two cases: mysql for webserver use, or mysql not for webserver use. Will the packages to be installed for the two cases be different?

Thanks and regards!

Tim
  • 24,657
  • 62
  • 151
  • 245

3 Answers3

9

The packages for the usages of MySQL will not vary at all. For a basic MySQL server (and client program so you can use the server), you will run the following:
sudo apt-get install mysql-server mysql-client

That will install both the server and the client program, as well as any dependencies that those programs require. The client program will allow you to interface with the database server. You may install the server without mysql-client, if you are going to not use the mysql command via the server's terminal (such as with a remote mysql client, or using the mysql command in a terminal from another computer).

NOTE: This stuff was originally in comments on @mbx's answer, but this is actually an answer, not a comment :P

Thomas Ward
  • 72,494
  • 30
  • 173
  • 237
  • Thanks! I have installed `php5-mysql` before. Will installing `mysql-server mysql-client` install the same thing? – Tim Jul 21 '11 at 02:07
  • No, `php5-mysql` is the PHP module/plugin that allows for PHP scripts and files to communicate with MySQL servers, but does not provide the servers themselves. The `mysql-server` package actually installs the MySQL Daemon (server), which processes database commands. The PHP plugin/module packages are managed separately from the server/client packages, and will not be affected by the installation of the `mysql-server` or `mysql-client` packages. – Thomas Ward Jul 21 '11 at 02:09
  • (1) Besides MYSQL, do all database management systems use the server-client model? (2) Are query languages used only on the client side of database management systems? – Tim Jul 21 '11 at 02:39
  • (1) Most follow that model. (2) I am not entitled to answer that question, as I am not a certified database administrator. Others here on askubuntu may be able to answer that question, but in my own opinion, that should be asked on superuser.stackexchange.com if you are truly interested in the answer. – Thomas Ward Jul 21 '11 at 02:44
  • @Tim (1) Access is a popular example fornot using that kind of model, as you usually connect to the `.mdb` file itself. You can thus deploy the database as a file without the (Server-)Application (Access). This is quite commonly used in consumer software, notably MediaMonkey and StudioLine3. (2) You can define Trigger in SQL which runs on the server (eg. update trigger for every insert). It does not to be stored als SQL though, but if you order a backup script it will be in SQL. – mbx Jul 22 '11 at 19:10
  • However, make a note that Access (Microsoft stuff) is horridly unstable. And as I said, ***most*** SQL server systems are configured with a server-client setup. Some are not, but most are. – Thomas Ward Jul 22 '11 at 19:11
  • @The Evil Phoenix Access is for the case: I don't want to annoy my customers having them to install a full DBMS. Sometimes they don't even want them to know a database is used at all... – mbx Jul 22 '11 at 19:14
  • true, which is why its one of those odd-ball Microsoft things :P – Thomas Ward Jul 22 '11 at 19:15
  • @mbx: Thanks! If Access doesn't "want to annoy customers having them to install a full DBMS", why doesn't it use client-server model so that customers can only install client application on their computers, leaving the server application on the server computer to do the heavy work? – Tim Jul 22 '11 at 20:18
  • @Tim because Access makes the database and the client one and the same. The server-client model is ideal for medium-to-large DBs. Access' model is ideal for small databases which are not accessed by many users. – Thomas Ward Jul 22 '11 at 20:22
  • @The: My question is that these two are contradictory to each other: "Access makes the database and the client one and the same" and Access doesn't "want to annoy customers having them to install a full DBMS". – Tim Jul 22 '11 at 20:33
  • @Tim they may not, but they usually are – mbx Jul 22 '11 at 20:37
  • @Tim There are several scenarios. Access is intended for one-user-at-a-time service, beeing small and easily shippable with a main application. Almost all Server RDBMSs are intended for parallel and competing service so you can run eg. 3 Frontend Webservers with dynamic content and only one DB in the Back. In Enterprise Systems on the other hand there often several applications (for sales, for r&d, human ressources etc.) using only one DB Server (wich is no problem if the load is low). – mbx Jul 22 '11 at 20:42
2

I'd recommend phpmyadmin running on apache. You can quite easily look at the content of your tables. SQL execution is also supported. For PosgreSQL there is pgadmin as standalone tool, MySQL Workbench seems to be a similar one.

If your server is public (even if not), you should change the default passwords.

I commonly use apt-get for installing packages, so

sudo apt-get install mysql-server mysql-client

should do the job, depending on your specific flavour of distribution. For a server only installation, you can even omit the mysql-client if you want to save some bytes. It is used to connect to your dbms from the command shell, so if you might need it once you can still do a lazy installation...

mbx
  • 184
  • 2
  • 5
  • 17
  • Thanks! If not for webserver use, will there be a smaller way to install mysql? – Tim Jul 21 '11 at 00:10
  • @The Evil Phoenix: Thanks! What is `mysql-client` for? I.e., in what cases do I need it? – Tim Jul 21 '11 at 01:15
  • @Tim: please read my answer to your question, as I did theoretically answer your question correctly, I moved my comments into an answer. – Thomas Ward Jul 21 '11 at 01:53
1

Consider reading this if you want to setup a LAMP on Ubuntu. You can also go to W3Schools for more learning material on SQL and others.

JohanSJA
  • 2,544
  • 1
  • 16
  • 15