This is an old revision of the document!
Installing MySQL with APT Install MySQL by the following command: shell> sudo apt-get install mysql-server Starting and Stopping the MySQL Server The MySQL server is started automatically after installation. You can check the status of the MySQL server with the following command: shell> sudo service mysql status Stop the MySQL server with the following command: shell> sudo service mysql stop To restart the MySQL server, use the following command: shell> sudo service mysql start
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' -> WITH GRANT OPTION; mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' -> WITH GRANT OPTION; mysql> CREATE USER 'admin'@'localhost' IDENTIFIED BY 'admin_pass'; mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost'; mysql> CREATE USER 'dummy'@'localhost';
#! /bin/bash mysql --user=root --password= --host=162.209.124.42 wrb@media-labs-server-2:~/queue/sql$ cat c #! /bin/bash mysql --user=wrb --password= --host=162.209.124.42 parks create database parks;
netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN tcp6 0 0 :::8080 :::* LISTEN tcp6 0 0 :::80 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 127.0.0.1:8005 :::* LISTEN tcp6 0 0 :::8009
# vi /etc/my.cnf Step # 3: Once file opened, locate line that read as follows [mysqld] Make sure line skip-networking is commented (or remove line) and add following line bind-address=YOUR-SERVER-IP For example, if your MySQL server IP is 65.55.55.2 then entire block should be look like as follows: [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/English bind-address = 65.55.55.2 # skip-networking .... ..
nc -z -w1 54.87.112.192 3306 Connection to 54.87.112.192 port 3306 [tcp/mysql] succeeded!
show tables; show grants; use mysql; describe user;
mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | servers | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 24 rows in set (0.00 sec) mysql>