This tutorial will show you howto install MySQL Database Server on Debian Linux Operating System. MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack (and other’AMP’ stacks).
Install MySQl server
Open a terminal or login using ssh. Type the following command to install the same:
# apt-get install mysql-server-5.1
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libxcb-render-util0-dev xulrunner-1.9.1 libxcb-render-util0 Use 'apt-get autoremove' to remove them. Selecting previously deselected package libnet-daemon-perl. (Reading database ... 159847 files and directories currently installed.) Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.43-1_all.deb) ... Selecting previously deselected package libplrpc-perl. Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ... Selecting previously deselected package libdbi-perl. Unpacking libdbi-perl (from .../libdbi-perl_1.612-1_amd64.deb) ... Selecting previously deselected package libdbd-mysql-perl. Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.016-1_amd64.deb) ... Selecting previously deselected package mysql-client-5.1. Unpacking mysql-client-5.1 (from .../mysql-client-5.1_5.1.49-3_amd64.deb) ... Selecting previously deselected package mysql-server-core-5.1. Unpacking mysql-server-core-5.1 (from .../mysql-server-core-5.1_5.1.49-3_amd64.deb) ... ... ,...
START / STOP / RESTART MYSQL SERVER
MySql will start on boot time. You can also type manually (as root) to start / stop / restart the server:
# /etc/init.d/mysql start # /etc/init.d/mysql stop # /etc/init.d/mysql restart # /etc/init.d/mysql status
# service mysql start # service mysql stop # service mysql restart # service mysql status
MySql Server Configuration
The MySQL database server configuration file is located at /etc/mysql/my.cnf. Edit the file using a text editor such as vi, type:
# vi /etc/mysql/my.cnf
# The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # This will be passed to all mysql clients # It has been reported that passwords should be enclosed with ticks/quotes # escpecially if they contain "#" chars... # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
Connect To MySQL Server
Type the following command:
$ mysql -u root -p
-u root: Login as admin root user.
-p : Prompt for root user password.