1th MySQL Introduction and Deployment 1.1 Introduction 1.1.1 What is data
Data refers to the recording of objective events and can be identified symbols, is the nature of the objective things, state and the relationship between the physical symbols or the combination of these physical symbols. It is a recognizable, abstract symbol.
1.1.2 Database Management System type---relationship type
Advantages:
Powerful query function
Strong consistency
Second-level index
Rdbms:oracle, MySQL, MSSQL (SQL Server), PG (PostgreSQL)
Scenario: Application scenarios with high data security requirements
1.1.3 Database management System type---non-relational
Advantages:
Flexible mode
Scalability
Performance
Nosql:redis, MongoDB, Memcache, Hbase, neo4j
Application scenario: For high performance requirements, data security requirements are not too high, generally with the RDBMS use of products
1.2 MySQL Deployment 1.2.1 installation method
1, RPM or Yum Installation: Easy installation, fast installation, no customization
2, binary: Do not need to install, decompression can be used, can not be customized functions
3. Compile and install: customizable, slow installation (before 5.5 version:./configure make made install | 5.5 after: cmake gmake)
1.2.2 Compiling and installing 1.2.3 installation Environment preparation
System version: Linux Centos-6.9 2.6.32-696.23.1.el6.x86_64
MySQL software version: 5.6.38
IP address and host name: 10.0.0.51 DB01
1.2.4 MySQL Package acquisition method
https://downloads.mysql.com/archives/community/#官网下载
1.2.5 Start Installation
(1) Install the dependent package:
Yum install-y ncurses-devel libaio-devel gcc-c++ gcc ncurses-devel freeglut-devel
(2) Installation CMake
Yum Install-y CMake
(3) Create a MySQL user to manage MySQL
Useradd-s/sbin/nologin-m MySQL
(4) Unpacking the package
Tar XF mysql-5.6.38.tar.gz
(5) Start compiling the installation
CD mysql-5.6.38????????????? #<==== into the extracted directory
CMake. -dcmake_install_prefix=/application/mysql-5.6.38 \
-dmysql_datadir=/application/mysql-5.6.38/data \
-dmysql_unix_addr=/application/mysql-5.6.38/tmp/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_extra_charsets=all \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwith_zlib=bundled \
-dwith_ssl=bundled \
-denabled_local_infile=1 \
-dwith_embedded_server=1 \
-denable_downloads=1 \
-dwith_debug=0
Make && make install #<====== compile installation
#===================================
What did Cmake do?
1, have done some pre-configuration
2, the impact of the compiled program (the compilation process will cmake specified configuration information hardcoded into the program file)
Mysqld
Mysql
mysql_install_db
Mysqldump
Mysqladmin
Mysqld_safe
such as
#=====================================
Ln-s/application/mysql-5.6.38//application/mysql????????? #<==== creating a soft link to the installation directory
CP support-files/my*.cnf/etc/my.cnf???????? #<=== copy my.conf to etc directory
#==================
/application/mysql/scripts/mysql_install_db--basedir=/application/mysql/--datadir=/application/mysql/data-- User=mysql #<===== Initializing database
#==================
Chown-r mysql.mysql/application/mysql/#<==== modifying software path attribution
CP support-files/mysql.server/etc/init.d/mysqld #<=== Copy boot script to sys-v mode directory
chmod 700/etc/init.d/mysqld
/etc/init.d/mysqld Start #<====== Startup database
Netstat-lntup|grep 3306 #<====== Check service port number
Echo ' path=/application/mysql/bin/: $PATH ' >>/etc/profile #<===== Add environment variable
Source/etc/profile
Mysql??? # "Enter" #启动mysql数据库, first boot no password
++++++++++++++++++++++++++++++ Expansion Part +++++++++++++++++++++++++++++++++++++
Change Password:
1. For example, your root user does not now have a password and you want the password to be changed to 123456, then the command is:
Mysqladmin-u Root Password 123456
2. If your root now has a password (123456), then the command to change the password to ABCdef is:
Mysqladmin-u root-p Password abcdef
Note that the command will ask you the old password, enter the old password 123456 after the command completes, the password modification succeeds.
3. If your root now has a password (123456), then the command to change the password to ABCdef is:
Mysqladmin-u root-p123456 Password abcdef (note-p do not and the following password points
Write, write together, or it will go wrong, the error is as follows)
4. Using phpMyAdmin, this is the simplest, modify the MySQL library's user table,
But don't forget to use the password function.
Forgot Password:
Below we provide 6 different ways to modify the MySQL root user's password, with the addition of MySQL users.
Method One
Using phpMyAdmin, this is the simplest, modify the MySQL library's user table,
But don't forget to use the password function.
Method Two
Using Mysqladmin, this is a special case of the preceding declaration.
Mysqladmin-u root-p Password mypasswd
After entering this command, you need to enter the root's original password, then the root password will be changed to MYPASSWD.
Change the root of the command to your username, and you can change your own password.
Of course if your mysqladmin is not connected to MySQL server, or you have no way to execute mysqladmin,
Then this method is ineffective.
And mysqladmin can't erase the password.
The following methods are used at the MySQL prompt and must have root privileges for MySQL:
Method Three
Mysql> INSERT into Mysql.user (Host,user,password)
VALUES ('% ', ' Jeffrey ', PASSWORD (' biscuit '));
Mysql> FLUSH Privileges
Specifically, this is the addition of a user named Jeffrey, with a password of biscuit.
There is this example in the MySQL Chinese reference manual, so I wrote it out.
Note that you want to use the password function, and then you also use the flush privileges.
Method Four
As with method Three, just use the Replace statement
Mysql> REPLACE into Mysql.user (Host,user,password)
VALUES ('% ', ' Jeffrey ', PASSWORD (' biscuit '));
Mysql> FLUSH Privileges
Method Five
Using the Set Password statement,
mysql> SET PASSWORD for [email protected] "%" = PASSWORD (' biscuit ');
The password () function must also be used,
However, you do not need to use flush privileges.
Method Six
Use Grant ... Identified by statement
Mysql> GRANT USAGE On * * to [e-mail protected] "%" identified by ' biscuit ';
Here the password () function is unnecessary and does not require the use of flush privileges.
Note: PASSWORD () [NOT] Execute password encryption in the same way that the UNIX password is encrypted.
MySQL Forgot Password Solution
If MySQL is running, first kill it: Killall-term mysqld.
Start Mysql:bin/safe_mysqld--skip-grant-tables &
You can go to MySQL without a password.
Then there is
>use MySQL
>update User Set Password=password ("New_pass") where user= "root";
>flush privileges;
Kill MySQL again and start MySQL in a normal way.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySQL-5.6.38 Installation Deployment and introduction