20

MySQL for Beginners - part 1

Embed Size (px)

Citation preview

●●●●

●○

●○

●○

●○

●○

MySQL 5.0

MySQL 5.1

MariaDB 5.1

MariaDB 5.2

MariaDB 5.3MySQL 5.5

MariaDB 5.5

MariaDB 10.0

MariaDB 10.1(1)

MySQL 5.6

MySQL 5.7Percona 5.7

Percona 5.6

Percona 5.5Percona 5.5

XtraDB Cluster

Percona 5.6XtraDB Cluster

MariaDB 5.5Cluster

MariaDB 10.0Cluster

MySQL AB

Sun Microsystems

Oracle

Percona

MariaDB

Missing:- MySQL/NDB Cluster- WebScaleSQL

Percona & MariaDB Cluster include Galera

(1)MariaDB 10.1 includes Galera

dev.mysql.com

downloads.mariadb.org

percona.com/downloads

scaledb@Ubuntu:~$ sudo apt-get install mysql-server

scaledb@Ubuntu:~$ sudo /etc/init.d/mysql start

scaledb@Ubuntu:~$ ps -awx | grep mysql

2555 ? Ssl 0:00 /usr/sbin/mysqld

scaledb@Ubuntu:~$ mysql -uroot

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 43

Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> \s

--------------

mysql Ver 14.14 Distrib 5.5.47, for debian-linux-gnu (x86_64) using readline 6.3

Connection id: 43Current database:Current user: root@localhostSSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)Protocol version: 10Connection: Localhost via UNIX socketServer characterset: latin1Db characterset: latin1Client characterset: utf8Conn. characterset: utf8UNIX socket: /var/run/mysqld/mysqld.sockUptime: 5 min 16 sec

Threads: 1 Questions: 584 Slow queries: 0 Opens: 189 Flush tables: 1 Open tables: 41 Queries per second avg: 1.848--------------

mysql>

$ sudo dpkg -i \ mysql-community-server_5.7.11-1ubuntu14.04_amd64.deb

$ rpm -i mysql-community-server-5.7.11-1.el7.x86_64.rpm

scaledb@Ubuntu:~$ cat /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.… [client]port = 3306socket = /var/run/mysqld/mysqld.sock… [mysqld]user = mysqlpid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockport = 3306basedir = /usrdatadir = /var/lib/mysqltmpdir = /tmp## 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

mysql>

mysql> grant all on *.* to root@'%';

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)