【整理】源码安装 mysql-5.6.10

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

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

【源码安装 mysql-5.6.10】

(1)解压 mysql 源码 

?


1

2

[root@Betty Me_wget]# tar zxvf mysql-5.6.10.tar.gz

[root@Betty Me_wget]# cd mysql-5.6.10

(2)创建 mysql 的安装目录及数据库存放目录 

?


1

2

[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 用户及用户组 

?


1

2

3

4

5

[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 命令。 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

[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 命令。 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

[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 命令。 

?


1

2

3

4

5

6

7

8

9

10

11

[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)设置目录权限 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

[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 配置文件 

?


1

[root@Betty mysql]# cp support-files/my-default.cnf /etc/my.cnf

(7)创建系统数据库的表 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

[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)设置环境变量 

?


1

[root@Betty mysql]# vi /root/.bash_profile 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

# .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 

?


1

[root@Betty mysql]# source /root/.bash_profile

(9)启动 mysql 服务器 

       若想使用 service 命令启动 mysql 需要将 mysql 启动脚本 support-files/mysql.server 添加到 /etc/init.d 目录下,如下设置:  

?


1

2

3

4

5

[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  ] 

?


1

2

3

4

5

[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 账号添加远程连接的能力 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

[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)删除本机匿名连接的空密码帐号 

?


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

[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>


时间: 2024-08-31 00:51:16

【整理】源码安装 mysql-5.6.10的相关文章

CentOS 6.3/6.4 Minimal 源码安装 MySQL 5.6.10

CentOS MySQL 5.6正式版发布了,相对于5.5版本作出了不少改进,其源码安装配置方式也有所变化,本文根据实际操作,不断尝试,精确还原了安装的具体步骤. 环境:CentOS 6.3/6.4 最小化缺省安装,配置好网卡. 安装MySQL前,确认Internet连接正常,以便下载安装文件. 先使用 yum -y update 指令升级系统到最新版本. 本安装将MySQL的数据文件与执行文件分离,如果你打算设置到不同的路径,注意修改对应的执行命令和数据库初始化脚本. # 修改防火墙设置,打开

CentOS 7中源码安装MySQL 5.7.6+详细教程_Mysql

配置说明      Linux版本:Centos7      MySQL版本:MySQL5.7.16      该文档适用于MySQL版本>=5.7.6 一.卸载CentOS7默认携带的mariadb包 # 检查mariadb安装包 [root@wing ~]# rpm -qa | grep -i mysql [root@wing ~]# rpm -qa | grep -i mariadb mariadb-libs-5.5.50-1.el7_2.x86_64 # 卸载mariadb安装包 [ro

源码安装 mysql 5.5.20升级到mysql 5.6.25

环境: centos 6.5  64 mysql 5.5.20 升级 5.6.25 mysql 5.5.20安装参考: http://blog.csdn.net/u010098331/article/details/50730391 mysql 5.6.25安装参考:      http://blog.csdn.net/u010098331/article/details/50886619 CentOS系统下将MySQL升级至5.6.25 (源码安装方式) 摘要:CentOS系统下将MySQL升

CentOS 6.3下如何源码安装MySQL GA 5.6.10

在编译安装 MySQL 5.6.x 之前,需要最少安装的包有:bison,gcc.gcc-c++.cmake.ncurses-devel, 安装这些依赖包后,把原来解压出来的mysql源码目录删除掉,再重新解压出来,再去编译. -- 0 Download mysql-5.6.10.tar.gz in dev.mysql.com -- 1 安装cmake软件包 tar xzvf cmake-2.8.3.tar.gz ./bootstrap gmake gmake install -- 2 crea

在Ubuntu上源码安装MySQL+安装问题解决+安全优化

0.说明         当然,MySQL的安装方法多种多样,在Ubuntu上,你可以采用apt-get的方式安装,这样的好处是:快速方便.基本上,它会帮你解决所有的函数库依赖问题,正常情况下,只要apt-get执行完成,那么MySQL也就可以使用了.         但我更倾向于使用源码的方式来安装MySQL,原因也很简单:除了有详细的官方文档外,你还可以非常清楚地知道你自己在做什么,这点在以后MySQL运行出现问题时将会有很大的帮助!         但即便是按照官方文档来安装,你也会遇到各

在CentOS上源码安装MySQL+安装问题解决+安全优化

0.说明         当然,MySQL的安装方法多种多样,在CentOS上,你可以采用YUM的方式安装,这样的好处是:快速方便.基本上,它会帮你解决所有的函数库依赖问题,正常情况下,只要YUM执行完成,那么MySQL也就可以使用了.         但我更倾向于使用源码的方式来安装MySQL,原因也很简单:除了有详细的官方文档外,你还可以非常清楚地知道你自己在做什么,这点在以后MySQL运行出现问题时将会有很大的帮助!         但即便是按照官方文档来安装,你也会遇到各种各样的问题,这

Linux平台使用源码安装MySQL 5.1到个人目录简易指南

1. 解压源码到个人目录: 2. 执行如下命令进行configure,注意源码默认情况下不支持innodb,必须使用--with-plugins手工指定(二进制包默认已经支持): ./configure --prefix=$HOME/local/mysql-5154 --with-extra-charsets=latin1,gbk,utf8 --with-plugins=partition,heap,innobase,myisam,myisammrg,csv 3. 执行如下命令编译和安装 mak

CentOS 6.8 源码安装mysql 5.6

一:卸载旧版本 rpm -qa | grep mysql rpm -e mysql #普通删除模式 rpm -e --nodeps xxx(xxx为刚才的显示的列表) # 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除 rm /etc/my.cnf #删除/etc/my.cnf   二:安装编译代码需要的包 yum -y install make gcc-c++ cmake bison-devel ncurses-devel   三:创建mysql用户

Centos 6.8 源码安装 mysql 5.6.15

一.安装环境 Linux CentOS 6.8 二.编译安装所需编译环境 cmake tar –axf cmake-2.8.4.tar.gz cd cmake-2.8.4 ./configure make make install 三.开始安装mysql 创建mysql用户和用户组 groupadd mysql useradd –r –g mysql mysql 编译mysql tar –axf mysql-5.6.15.tar.gz cd mysql-5.6.15 cmake -DCMAKE_

CentOS 源码安装 MySQL 5.6.12数据库教程

1:下载:当前mysql版本到了5.6.12 下载地址:http://dev.mysql.com/downloads/mysql/ 选择"Source Code"  在最下面 找个 (mysql-5.6.12.tar.gz) 选择下载  wget 你懂的. 2:必要软件包  代码如下 复制代码 yum -y install  gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt