手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

MySQL源码安装

[日期:2014-04-25] 来源:Linux社区  作者:Richardzhu [字体:大 中 小]

十二、修改MySQL的root用户密码以及打开远程连接

 
[root@node4 ~]# /opt/mysql5.5/bin/mysql -u root mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2011, 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> use mysql;
Database changed
mysql> desc user;
----为root添加远程连接的能力。
mysql
> grant all privileges on *.* to root@"%" identified by "root"; Query OK, 0 rows affected (0.03 sec) mysql> update user set Password = password('123456') where User='root'; Query OK, 5 rows affected (0.02 sec) Rows matched: 5 Changed: 5 Warnings: 0 mysql> select Host,User,Password from user where User='root'; +-----------+------+-------------------------------------------+ | Host | User | Password | +-----------+------+-------------------------------------------+ | localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | node4 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | 127.0.0.1 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | ::1 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | % | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | +-----------+------+-------------------------------------------+ 5 rows in set (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> exit; Bye [root@node4 ~]# /opt/mysql5.5/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.22-log Source distribution Copyright (c) 2000, 2011, 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.10 sec) mysql> select version(); +------------+ | version() | +------------+ | 5.5.22-log | +------------+ 1 row in set (0.02 sec)
 

附录:
1. groupadd mysql
2. useradd -g mysql mysql
3. tar zxvf mysql-VERSION.tar.gz
4. cd mysql-VERSION
5. ./configure --prefix=/usr/local/mysql
--without-debug
--enable-thread-safe-client
--enable-assembler
--enable-profiling
--with-mysqld-ldflags=-all-static
--with-client-ldflags=-all-static
--with-charset=latin1
--with-extra-charsets=utf8,gbk
--with-mysqld-user=mysql
--without-embedded-server
--with-server-suffix=bbk
--with-plugins=innobase,partition
6. make
7. make install
8.mkdir data
9.chown mysql:mysql ./data/ -R
10. cp support-files/my-medium.cnf /etc/my.cnf
11.在my.cnf mysqld标签下中添加:
basedir=/opt/mysql5
datadir=/opt/mysql5/data
12. ./bin/mysql_install_db --default-file=./my.cnf --user=mysql
13. select version();

linux
相关资讯       MySQL安装  MySQL源码安装 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款