Introduction and installation of Mysql



Contents of this article:

1.Introduction to Mysql

2.Mysql installation

3. Graphical tools



1.Introduction to Mysql


Wikipedia—click to open link


MySQL is a relational database management system developed by the Swedish MySQL AB company and is currently a product of Oracle. MySQL is one of the most popular relational database management systems. In terms of WEB applications, MySQL is the best RDBMS (Relational Database Management System) application software.
MySQL is a relational database management system. A relational database stores data in different tables instead of putting all data in one big warehouse, which increases speed and improves flexibility.
The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts a dual licensing policy and is divided into community version and commercial version. Due to its small size, fast speed, low total cost of ownership, and especially the characteristics of open source, MySQL is generally chosen as the website database for the development of small and medium-sized websites.
Due to the excellent performance of its community version, it can form a good development environment with PHP and Apache.

Written in C and C++, it supports AIX, FreeBSD, HP-UX, Linux, Mac OS, NovellNetware, OpenBSD, OS/2 Wrap, Solaris, Windows and other operating systems.
APIs are provided for multiple programming languages. These programming languages ​​include C, C++, Python, Java, Perl, PHP, Eiffel, Ruby, .NET and Tcl, etc.

Mysql supports large databases. Can handle large databases with tens of millions of records.

MySQL supports large databases and data warehouses with 50 million records. The 32-bit system table file can support a maximum of 4GB, and the 64-bit system supports a maximum table file of 8TB.

Many large companies are also using it, such as FaceBook, Tencent, etc. Because it is free and open source, basically most small companies are also using Mysql.



2.Mysql installation and configuration


Download address: Mysql official website—click to open the link

Installation tutorial: Mysql official website—click to open the link


ubuntu installation:


1.Installation

sudo apt-get install mysql-server


If you are not a super user, you will be asked to enter your root password.

2.Set password

After the download is completed, jump to a new interface and set the password for the mysql root account.

Then confirm the password

3. Authorize users and allow remote login

After the above operations are completed, enter

mysql -u root -p

Log in, and then create a user for remote connection
GRANT ALL PRIVILEGES ON *.* TO 'ubuntu'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

refresh
FLUSH PRIVILEGES;

quit
quit

4. Open remote connection
MySQL is used locally by default. There is no open remote connection, so you need to modify it in the configuration file.


sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

Comment out "bind-address = 127.0.0.1" and comment it with #

5. Restart Mysql

service mysql restart

Then you can use the tool to connect remotely!




Centos installation:


In Centos 7, Mysql was replaced by MariaDB (a branch of Mysql, not much different from mysql),
so please refer to the installation method before Centos 7 :
http://blog.csdn.net/xyang81/article/details/51759200


After Centos7:

1. Install MariaDB

yum -y install mariadb mariadb-server


2. Start MariaDB and set it to start at boot

systemctl start mariadb
systemctl enable mariadb


3. Set up MariaDB:

mysql_secure_installation


设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
其他配置:
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车


初始化MariaDB完成。




4.配置MariaDB的字符集为utf-8
 

文件/etc/my.cnf

vi /etc/my.cnf


在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci' 
init_connect='SET NAMES utf8' 
character-set-server=utf8 
collation-server=utf8_unicode_ci 
skip-character-set-client-handshake


文件/etc/my.cnf.d/client.cnf
vi /etc/my.cnf.d/client.cnf


在[client]中添加
default-character-set=utf8


文件/etc/my.cnf.d/mysql-clients.cnf
vi /etc/my.cnf.d/mysql-clients.cnf

在[mysql]中添加
default-character-set=utf8

 全部配置完成,重启mariadb
systemctl restart mariadb


之后进入MariaDB查看字符集
mysql> show variables like "%character%";show variables like "%collation%";

显示为
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client    | utf8                      |
| character_set_connection | utf8                      |
| character_set_database  | utf8                      |
| character_set_filesystem | binary                    |
| character_set_results    | utf8                      |
| character_set_server    | utf8                      |
| character_set_system    | utf8                      |
| character_sets_dir      | /usr/mysqlarsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
+----------------------+-----------------+
| Variable_name        | Value          |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database  | utf8_unicode_ci |
| collation_server    | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)


字符集配置完成。


5.添加用户,设置权限


创建用户命令

mysql>create user username@localhost identified by 'password';

授予外网登陆权限 
mysql>grant all privileges on *.* to username@'%' identified by 'password';

Windos安装:
Windos都是图形化安装,太简单,略,直接上搜索引擎进行搜索安装即可。


3.图形化工具


推荐的SQL连接工具(windos版本):
Navicat Premium_11.2.7简体中文完美破解版
http://download.csdn.net/detail/ahgaoyong/9482314



Mysql下一篇:

http://blog.csdn.net/qq_33613696/article/details/77435281



Guess you like

Origin blog.csdn.net/qq_33613696/article/details/77372666