【整理】源码安装 mysql-5.6.10


       参考别人的经验,加上自己的理解,完成下面的动作。

==============================


【源码安装 mysql-5.6.10】

(1)解压 mysql 源码
[root@Betty Me_wget]# tar zxvf mysql-5.6.10.tar.gz 
[root@Betty Me_wget]# cd mysql-5.6.10 

(2)创建 mysql 的安装目录及数据库存放目录
[root@Betty mysql-5.6.10]# mkdir -p /usr/local/mysql 
[root@Betty mysql-5.6.10]# mkdir -p /usr/local/mysql/data 

(3)创建 mysql 用户及用户组
[root@Betty mysql-5.6.10]# groupadd mysql 
groupadd: group mysql exists 
[root@Betty mysql-5.6.10]# useradd -r -g mysql mysql 
useradd: user mysql exists 
[root@Betty mysql-5.6.10]#  
因为我之前已经安装过一次,所以上面说用户组和用户已存在。

(4)安装 mysql

参数说明:

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql    //安装目录
-DINSTALL_DATADIR=/usr/local/mysql/data     //数据库存放目录
-DDEFAULT_CHARSET=utf8                            //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci          //校验字符
-DEXTRA_CHARSETS=all                                  //安装所有扩展字符集
-DENABLED_LOCAL_INFILE=1                          //允许从本地导入数据

执行 cmake 命令。
[root@Betty mysql-5.6.10]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 
-- Running cmake version 2.8.10.2 
-- The C compiler identification is GNU 4.1.2 
-- The CXX compiler identification is GNU 4.1.2 
-- Check for working C compiler: /usr/bin/cc 
-- Check for working C compiler: /usr/bin/cc -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Check for working CXX compiler: /usr/bin/c++ 
-- Check for working CXX compiler: /usr/bin/c++ -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
...... 
-- Check size of pthread_t 
-- Check size of pthread_t - done 
-- Performing Test HAVE_PEERCRED 
-- Performing Test HAVE_PEERCRED - Success 
-- Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source. 
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://foo.bar.com:80 
Warning: Bison executable not found in PATH 
-- Configuring done 
-- Generating done 
-- Build files have been written to: /root/Me_wget/mysql-5.6.10 
[root@Betty mysql-5.6.10]#  
执行 make 命令。
[root@Betty mysql-5.6.10]# make 
Scanning dependencies of target INFO_BIN 
[  0%] Built target INFO_BIN 
Scanning dependencies of target INFO_SRC 
[  0%] Built target INFO_SRC 
Scanning dependencies of target abi_check 
[  0%] Built target abi_check 
Scanning dependencies of target zlib 
[  0%] Building C object zlib/CMakeFiles/zlib.dir/adler32.c.o 
[  0%] Building C object zlib/CMakeFiles/zlib.dir/compress.c.o 
[  0%] Building C object zlib/CMakeFiles/zlib.dir/crc32.c.o 
[  0%] Building C object zlib/CMakeFiles/zlib.dir/deflate.c.o 
[  0%] Building C object zlib/CMakeFiles/zlib.dir/gzio.c.o 
.... 
Linking CXX static library libsql_embedded.a 
[ 99%] Built target sql_embedded 
[ 99%] Generating mysqlserver_depends.c 
Scanning dependencies of target mysqlserver 
[ 99%] Building C object libmysqld/CMakeFiles/mysqlserver.dir/mysqlserver_depends.c.o 
Linking C static library libmysqld.a 
/usr/bin/ar: creating /root/Me_wget/mysql-5.6.10/libmysqld/libmysqld.a 
[ 99%] Built target mysqlserver 
Scanning dependencies of target mysql_client_test_embedded 
[ 99%] Building C object libmysqld/examples/CMakeFiles/mysql_client_test_embedded.dir/__/__/tests/mysql_client_test.c.o 
Linking CXX executable mysql_client_test_embedded 
[ 99%] Built target mysql_client_test_embedded 
Scanning dependencies of target mysql_embedded 
[ 99%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/completion_hash.cc.o 
[ 99%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/mysql.cc.o 
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o 
Linking CXX executable mysql_embedded 
[100%] Built target mysql_embedded 
Scanning dependencies of target mysqltest_embedded 
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o 
Linking CXX executable mysqltest_embedded 
[100%] Built target mysqltest_embedded 
Scanning dependencies of target my_safe_process 
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o 
Linking CXX executable my_safe_process 
[100%] Built target my_safe_process 
执行 make install 命令。
[root@Betty mysql-5.6.10]# make install 
[  0%] Built target INFO_BIN 
[  0%] Built target INFO_SRC 
[  0%] Built target abi_check 
[  1%] Built target zlib 
[  2%] Built target yassl 
[  4%] Built target taocrypt 
[  6%] Built target edit 
[ 10%] Built target strings 
[ 18%] Built target mysys 
...... 

(5)设置目录权限
[root@Betty mysql-5.6.10]# cd /usr/local/mysql 
[root@Betty mysql]# ll 
total 76 
-rw-r--r--  1 root root 17987 Jan 23 00:54 COPYING 
-rw-r--r--  1 root root  7468 Jan 23 00:55 INSTALL-BINARY 
-rw-r--r--  1 root root  2552 Jan 23 00:54 README 
drwxr-xr-x  2 root root  4096 May  6 13:57 bin 
drwxr-xr-x  4 root root  4096 May  6 13:57 data 
drwxr-xr-x  2 root root  4096 May  6 13:58 docs 
drwxr-xr-x  3 root root  4096 May  6 13:57 include 
drwxr-xr-x  3 root root  4096 May  6 13:57 lib 
drwxr-xr-x  4 root root  4096 May  6 13:57 man 
drwxr-xr-x 10 root root  4096 May  6 13:57 mysql-test 
drwxr-xr-x  2 root root  4096 May  6 13:57 scripts 
drwxr-xr-x 28 root root  4096 May  6 13:57 share 
drwxr-xr-x  4 root root  4096 May  6 13:57 sql-bench 
drwxr-xr-x  3 root root  4096 May  6 13:57 support-files 
[root@Betty mysql]# chown -R root:mysql . 
[root@Betty mysql]# ll 
total 76 
-rw-r--r--  1 root mysql 17987 Jan 23 00:54 COPYING 
-rw-r--r--  1 root mysql  7468 Jan 23 00:55 INSTALL-BINARY 
-rw-r--r--  1 root mysql  2552 Jan 23 00:54 README 
drwxr-xr-x  2 root mysql  4096 May  6 13:57 bin 
drwxr-xr-x  4 root mysql  4096 May  6 13:57 data 
drwxr-xr-x  2 root mysql  4096 May  6 13:58 docs 
drwxr-xr-x  3 root mysql  4096 May  6 13:57 include 
drwxr-xr-x  3 root mysql  4096 May  6 13:57 lib 
drwxr-xr-x  4 root mysql  4096 May  6 13:57 man 
drwxr-xr-x 10 root mysql  4096 May  6 13:57 mysql-test 
drwxr-xr-x  2 root mysql  4096 May  6 13:57 scripts 
drwxr-xr-x 28 root mysql  4096 May  6 13:57 share 
drwxr-xr-x  4 root mysql  4096 May  6 13:57 sql-bench 
drwxr-xr-x  3 root mysql  4096 May  6 13:57 support-files 
[root@Betty mysql]# chown -R mysql:mysql data 
[root@Betty mysql]# ll 
total 76 
-rw-r--r--  1 root  mysql 17987 Jan 23 00:54 COPYING 
-rw-r--r--  1 root  mysql  7468 Jan 23 00:55 INSTALL-BINARY 
-rw-r--r--  1 root  mysql  2552 Jan 23 00:54 README 
drwxr-xr-x  2 root  mysql  4096 May  6 13:57 bin 
drwxr-xr-x  4 mysql mysql  4096 May  6 13:57 data 
drwxr-xr-x  2 root  mysql  4096 May  6 13:58 docs 
drwxr-xr-x  3 root  mysql  4096 May  6 13:57 include 
drwxr-xr-x  3 root  mysql  4096 May  6 13:57 lib 
drwxr-xr-x  4 root  mysql  4096 May  6 13:57 man 
drwxr-xr-x 10 root  mysql  4096 May  6 13:57 mysql-test 
drwxr-xr-x  2 root  mysql  4096 May  6 13:57 scripts 
drwxr-xr-x 28 root  mysql  4096 May  6 13:57 share 
drwxr-xr-x  4 root  mysql  4096 May  6 13:57 sql-bench 
drwxr-xr-x  3 root  mysql  4096 May  6 13:57 support-files 
[root@Betty mysql]#  
       上述命令将数据目录 data 的所属用户和所属用户组均设置为 mysql ,而将 mysql 目录下的其他文件的所属用户设置为 root ,所属组设置为 mysql 。


(6)设置 mysql 配置文件
[root@Betty mysql]# cp support-files/my-default.cnf /etc/my.cnf  

(7)创建系统数据库的表
[root@Betty mysql]# scripts/mysql_install_db --user=mysql 
Installing MySQL system tables...2013-05-06 15:22:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2013-05-06 15:22:18 19328 [Note] InnoDB: The InnoDB memory heap is disabled 
2013-05-06 15:22:18 19328 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2013-05-06 15:22:18 19328 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2013-05-06 15:22:18 19328 [Note] InnoDB: CPU does not support crc32 instructions 
2013-05-06 15:22:18 19328 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2013-05-06 15:22:18 19328 [Note] InnoDB: Completed initialization of buffer pool 
2013-05-06 15:22:18 19328 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 
2013-05-06 15:22:18 19328 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 
2013-05-06 15:22:18 19328 [Note] InnoDB: Database physically writes the file full: wait... 
2013-05-06 15:22:18 19328 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 
2013-05-06 15:22:20 19328 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 
2013-05-06 15:22:21 19328 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 
2013-05-06 15:22:21 19328 [Warning] InnoDB: New log files created, LSN=45781 
2013-05-06 15:22:21 19328 [Note] InnoDB: Doublewrite buffer not found: creating new 
2013-05-06 15:22:21 19328 [Note] InnoDB: Doublewrite buffer created 
2013-05-06 15:22:21 19328 [Note] InnoDB: 128 rollback segment(s) are active. 
2013-05-06 15:22:21 19328 [Warning] InnoDB: Creating foreign key constraint system tables. 
2013-05-06 15:22:21 19328 [Note] InnoDB: Foreign key constraint system tables created 
2013-05-06 15:22:21 19328 [Note] InnoDB: Creating tablespace and datafile system tables. 
2013-05-06 15:22:21 19328 [Note] InnoDB: Tablespace and datafile system tables created. 
2013-05-06 15:22:21 19328 [Note] InnoDB: Waiting for purge to start 
2013-05-06 15:22:21 19328 [Note] InnoDB: 1.2.10 started; log sequence number 0 
2013-05-06 15:22:21 19328 [Note] Binlog end 
2013-05-06 15:22:21 19328 [Note] InnoDB: FTS optimize thread exiting. 
2013-05-06 15:22:21 19328 [Note] InnoDB: Starting shutdown... 
2013-05-06 15:22:22 19328 [Note] InnoDB: Shutdown completed; log sequence number 1625977 
OK 


Filling help tables...2013-05-06 15:22:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2013-05-06 15:22:22 19351 [Note] InnoDB: The InnoDB memory heap is disabled 
2013-05-06 15:22:22 19351 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2013-05-06 15:22:22 19351 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2013-05-06 15:22:22 19351 [Note] InnoDB: CPU does not support crc32 instructions 
2013-05-06 15:22:22 19351 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2013-05-06 15:22:22 19351 [Note] InnoDB: Completed initialization of buffer pool 
2013-05-06 15:22:22 19351 [Note] InnoDB: Highest supported file format is Barracuda. 
2013-05-06 15:22:22 19351 [Note] InnoDB: 128 rollback segment(s) are active. 
2013-05-06 15:22:22 19351 [Note] InnoDB: Waiting for purge to start 
2013-05-06 15:22:22 19351 [Note] InnoDB: 1.2.10 started; log sequence number 1625977 
2013-05-06 15:22:23 19351 [Note] Binlog end 
2013-05-06 15:22:23 19351 [Note] InnoDB: FTS optimize thread exiting. 
2013-05-06 15:22:23 19351 [Note] InnoDB: Starting shutdown... 
2013-05-06 15:22:24 19351 [Note] InnoDB: Shutdown completed; log sequence number 1625987 
OK 


To start mysqld at boot time you have to copy 
support-files/mysql.server to the right place for your system 


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! 
To do so, start the server, then issue the following commands: 


  ./bin/mysqladmin -u root password 'new-password' 
  ./bin/mysqladmin -u root -h Betty password 'new-password' 


Alternatively you can run: 


  ./bin/mysql_secure_installation 


which will also give you the option of removing the test 
databases and anonymous user created by default.  This is 
strongly recommended for production servers. 


See the manual for more instructions. 


You can start the MySQL daemon with: 


  cd . ; ./bin/mysqld_safe & 


You can test the MySQL daemon with mysql-test-run.pl 


  cd mysql-test ; perl mysql-test-run.pl 


Please report any problems with the ./bin/mysqlbug script! 


The latest information about MySQL is available on the web at 


  http://www.mysql.com 


Support MySQL by buying support/licenses at http://shop.mysql.com 


New default config file was created as ./my.cnf and 
will be used by default by the server when you start it. 
You may edit this file to change server settings 


WARNING: Default config file /etc/my.cnf exists on the system 
This file will be read by default by the MySQL server 
If you do not want to use this, either remove it, or use the 
--defaults-file argument to mysqld_safe when starting the server 


[root@Betty mysql]#  

(8)设置环境变量
[root@Betty mysql]# vi /root/.bash_profile 
# .bash_profile 

# Get the aliases and functions 
if [ -f ~/.bashrc ]; then 
        . ~/.bashrc 
fi 

# User specific environment and startup programs 

#PATH=$PATH:$HOME/bin 
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin 

export PATH 
unset USERNAME 
[root@Betty mysql]# source /root/.bash_profile 

(9)启动 mysql 服务器


       若想使用 service 命令启动 mysql 需要将 mysql 启动脚本 support-files/mysql.server 添加到 /etc/init.d 目录下,如下设置: 
[root@Betty mysql]# cp support-files/mysql.server  /etc/init.d/mysql 
[root@Betty mysql]# ll /etc/init.d/mysql  
-rwxr-xr-x 1 root root 10650 May  6 14:11 /etc/init.d/mysql 
[root@Betty mysql]# /etc/init.d/mysql start 
Starting MySQL.                                            [  OK  ] 
[root@Betty mysql]# ps aux|grep mysql 
root      4070  0.0  0.0   8732  1168 pts/1    S    14:51   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/Betty.pid 
mysql     4185  0.0  2.2 447880 86952 pts/1    Sl   14:51   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/Betty.err --pid-file=/usr/local/mysql/data/Betty.pid 
root      4221  0.0  0.0   6064   572 pts/1    S+   14:54   0:00 grep mysql 
[root@Betty mysql]#  

(10)为 root 账号添加远程连接的能力
[root@Betty ~]# mysql -u root -p 
Enter password:  
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 7 
Server version: 5.6.10-log Source distribution 


Copyright (c) 2000, 2013, 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> use mysql; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A 


Database changed 


mysql>  
mysql> desc user; 
+------------------------+-----------------------------------+------+-----+---------+-------+ 
| Field                  | Type                              | Null | Key | Default | Extra | 
+------------------------+-----------------------------------+------+-----+---------+-------+ 
| Host                   | char(60)                          | NO   | PRI |         |       | 
| User                   | char(16)                          | NO   | PRI |         |       | 
| Password               | char(41)                          | NO   |     |         |       | 
| Select_priv            | enum('N','Y')                     | NO   |     | N       |       | 
| Insert_priv            | enum('N','Y')                     | NO   |     | N       |       | 
| Update_priv            | enum('N','Y')                     | NO   |     | N       |       | 
| Delete_priv            | enum('N','Y')                     | NO   |     | N       |       | 
| Create_priv            | enum('N','Y')                     | NO   |     | N       |       | 
| Drop_priv              | enum('N','Y')                     | NO   |     | N       |       | 
| Reload_priv            | enum('N','Y')                     | NO   |     | N       |       | 
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N       |       | 
| Process_priv           | enum('N','Y')                     | NO   |     | N       |       | 
| File_priv              | enum('N','Y')                     | NO   |     | N       |       | 
| Grant_priv             | enum('N','Y')                     | NO   |     | N       |       | 
| References_priv        | enum('N','Y')                     | NO   |     | N       |       | 
| Index_priv             | enum('N','Y')                     | NO   |     | N       |       | 
| Alter_priv             | enum('N','Y')                     | NO   |     | N       |       | 
| Show_db_priv           | enum('N','Y')                     | NO   |     | N       |       | 
| Super_priv             | enum('N','Y')                     | NO   |     | N       |       | 
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N       |       | 
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N       |       | 
| Execute_priv           | enum('N','Y')                     | NO   |     | N       |       | 
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N       |       | 
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N       |       | 
| Create_view_priv       | enum('N','Y')                     | NO   |     | N       |       | 
| Show_view_priv         | enum('N','Y')                     | NO   |     | N       |       | 
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N       |       | 
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N       |       | 
| Create_user_priv       | enum('N','Y')                     | NO   |     | N       |       | 
| Event_priv             | enum('N','Y')                     | NO   |     | N       |       | 
| Trigger_priv           | enum('N','Y')                     | NO   |     | N       |       | 
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N       |       | 
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       | 
| ssl_cipher             | blob                              | NO   |     | NULL    |       | 
| x509_issuer            | blob                              | NO   |     | NULL    |       | 
| x509_subject           | blob                              | NO   |     | NULL    |       | 
| max_questions          | int(11) unsigned                  | NO   |     | 0       |       | 
| max_updates            | int(11) unsigned                  | NO   |     | 0       |       | 
| max_connections        | int(11) unsigned                  | NO   |     | 0       |       | 
| max_user_connections   | int(11) unsigned                  | NO   |     | 0       |       | 
| plugin                 | char(64)                          | YES  |     |         |       | 
| authentication_string  | text                              | YES  |     | NULL    |       | 
| password_expired       | enum('N','Y')                     | NO   |     | N       |       | 
+------------------------+-----------------------------------+------+-----+---------+-------+ 
43 rows in set (0.00 sec) 


mysql>  
mysql>  
mysql> select host,user,password from user; 
+-----------+------+----------+ 
| host      | user | password | 
+-----------+------+----------+ 
| localhost | root |          | 
| Betty     | root |          | 
| 127.0.0.1 | root |          | 
| ::1       | root |          | 
| localhost |      |          | 
| Betty     |      |          | 
+-----------+------+----------+ 
6 rows in set (0.00 sec) 


mysql>  
mysql>  
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root"; 
Query OK, 0 rows affected (0.00 sec) 


mysql> select host,user,password from user; 
+-----------+------+-------------------------------------------+ 
| host      | user | password                                  | 
+-----------+------+-------------------------------------------+ 
| localhost | root |                                           | 
| Betty     | root |                                           | 
| 127.0.0.1 | root |                                           | 
| ::1       | root |                                           | 
| localhost |      |                                           | 
| Betty     |      |                                           | 
| %         | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 
+-----------+------+-------------------------------------------+ 
7 rows in set (0.00 sec) 


mysql> flush privileges; 
Query OK, 0 rows affected (0.00 sec) 


mysql>  
mysql> exit 
Bye 
[root@Betty ~]#  

(11)删除本机匿名连接的空密码帐号
[root@Betty ~]# mysql -u root -p 
Enter password:  
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 7 
Server version: 5.6.10-log Source distribution 


Copyright (c) 2000, 2013, 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> use mysql; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A 


Database changed 
mysql>  
mysql> select Host,User,Password from user; 
+-----------+------+-------------------------------------------+ 
| Host      | User | Password                                  | 
+-----------+------+-------------------------------------------+ 
| localhost | root |                                           | 
| Betty     | root |                                           | 
| 127.0.0.1 | root |                                           | 
| ::1       | root |                                           | 
| localhost |      |                                           | 
| Betty     |      |                                           | 
| %         | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 
+-----------+------+-------------------------------------------+ 
7 rows in set (0.00 sec) 


mysql> delete from user where password=""; 
Query OK, 6 rows affected (0.00 sec) 


mysql>  
mysql> flush privileges; 
Query OK, 0 rows affected (0.00 sec) 


mysql>  
mysql> select Host,User,Password from user; 
+------+------+-------------------------------------------+ 
| Host | User | Password                                  | 
+------+------+-------------------------------------------+ 
| %    | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 
+------+------+-------------------------------------------+ 
1 row in set (0.00 sec) 


mysql>  
mysql>  



你可能感兴趣的:(mysql)