Ubuntu LINUX安装mysql-5.6.31

#1 Ubuntu LINUX安装mysql-5.6.31

  #1.1 下载压缩包mysql-5.6.31.tar.gz并解压到目录 /mysql-5.6.31。

  #1.2 进入源码目录/mysql-5.6.31/mysql-5.6.31, 运行:

          cmake ../mysql-5.6.31 -DCMAKE_INSTALL_PREFIX=/mysql.5.6.31.bin -DWITH_DEBUG=1

           make

           make install

#2 参考《refman-5.6-en.a4.pdf》 配置mysql-5.6.31,关键点:

 #2.1 创建LINUX 组mysqlhuang 和 LINUX用户 mysqlhuang,我们使用用户mysqlhuang管理MySQL,不是默认的用户mysql。

 #2.2 初始化数据库时,生成随机密码:scripts/mysql_install_db --user=mysqlhuang --random-passwords

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# Preconfiguration setup
shell> groupadd mysqlhuang
shell> useradd -r -g mysqlhuang -s /bin/false mysqlhuang

# Beginning of source-build specific instructions
shell> tar zxvf mysql-5.6.31.tar.gz

# change to code path
shell> cd mysql-5.6.31
shell> cmake ../mysql-5.6.31 -DCMAKE_INSTALL_PREFIX=/mysql.5.6.31.bin -DWITH_DEBUG=1
shell> make
shell> make install

# End of source-build specific instructions
# Postinstallation setup
shell> cd /mysql.5.6.31.bin
shell> chown -R mysqlhuang .
shell> chgrp -R mysqlhuang .

# random passwords,下面一定记住随机密码,第一次登录要使用。
shell> scripts/mysql_install_db --user=mysqlhuang --random-passwords
shell> chown -R root .
shell> chown -R mysqlhuang data
shell> bin/mysqld_safe --user=mysqlhuang &

# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#3 启动,停止,登录MySQL。

#3.1 启动:   bin/mysqld_safe --user=mysqlhuang --general-log &

#3.2 停止:   bin/mysqladmin -u root shutdown -p

#3.3 登录:   bin/mysql -uroot -p, 第一次登录使用生成的随机密码,登录后修改root的密码即可。

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'::1' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'mysqldbserver-virtual-machine' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'ip6-localnet' = PASSWORD('new_password');

-----------

ref. doc

[1]  refman-5.6-en.a4.pdf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值