64位Aliyun Linux 15.1安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
来源:互联网 发布:seo标题 编辑:程序博客网 时间:2024/05/01 07:37
1.从官网上下载mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
地址:http://dev.mysql.com/downloads/mysql/
2 . 解压安装包并将解压包里的内容拷贝到mysql的安装目录/usr/local/mysql/
注:如果你的安装路径不是默认/usr/local/mysql/则需要修改配置文件
# tar -xzvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz# cd mysql-5.7.9-linux-glibc2.5-x86_64 # mv * /usr/local/mysql
3.创建mysql的用户组/用户, data目录及其用户目录
# groupadd mysql# useradd -r -g mysql mysql# mkdir /usr/local/mysql/data
4 . 初始化mysql数据库
# cd /usr/local/mysql# ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
5 . 检测下是否能启动mysql服务
# cd /usr/local/mysql# ./support-files/mysql.server startStarting MySQL.. SUCCESS!
6 . 创建软链接
# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
7 . 配置mysql服务开机自动启动
拷贝启动文件到/etc/init.d/下并重命令为mysqld
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
8 .增加执行权限
# chmod 755 /etc/init.d/mysqld
9 .检查自启动项列表中没有mysqld这个,如果没有就添加mysqld:
# chkconfig --list mysqld# chkconfig --add mysqld
10 .mysql服务的启动/重启/停止
启动mysql服务
# service mysqld start
重启mysql服务
# service mysqld restart
停止mysql服务
# service mysqld stop
11 . 初始化mysql用户root的密码
先将mysql服务停止,进入mysql安装目录, 执行:
# cd /usr/local/mysql# ./bin/mysqld_safe --skip-grant-tables --skip-networking&[1] 6225[root@localhost mysql]# 151110 02:46:08 mysqld_safe Logging to '/home/mysql/data/localhost.localdomain.err'.151110 02:46:08 mysqld_safe Starting mysqld daemon with databases from /home/mysql/data
12 .另外打开一个终端, 执行操作如下:
# mysql -u root mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.9 MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql;Database changedmysql> UPDATE user SET password=PASSWORD('123456') WHERE user='root';ERROR 1054 (42S22): Unknown column 'password' in 'field list'mysql> update user set authentication_string = PASSWORD('123456') where user = 'root';Query OK, 1 row affected, 1 warning (0.02 sec)Rows matched: 1 Changed: 1 Warnings: 1mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> \s--------------mysql Ver 14.14 Distrib 5.7.9, for linux-glibc2.5 (x86_64) using EditLine wrapperConnection id: 2Current database: mysqlCurrent user: root@SSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.7.9 MySQL Community Server (GPL)Protocol version: 10Connection: Localhost via UNIX socketServer characterset: utf8Db characterset: utf8Client characterset: utf8Conn. characterset: utf8UNIX socket: /tmp/mysql.sockUptime: 4 min 47 secThreads: 1 Questions: 43 Slow queries: 0 Opens: 127 Flush tables: 1 Open tables: 122 Queries per second avg: 0.149--------------mysql> exit;Bye
到此, 设置完mysql用户root的密码且确保mysql编码集是utf8, 注意上面, 新版本的mysql.user表里的密码字段是authentication_string
快捷键ctrl + c停止# ./bin/mysqld_safe …命令, 重新启动mysql服务, 用新密码连接mysql:
# service mysqld startStarting MySQL SUCCESS! [root@localhost bin]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.9Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql > exit;Bye
咦?又要我改密码, 我们通过mysqladmin来修改密码, 先输入原密码, 再设置新密码, 总算可以了吧!!!
# cd /home/mysql# ./bin/mysqladmin -u root -p passwordEnter password: New password: Confirm new password: Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 6Server version: 5.7.9 MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql>
到此, 完成了mysql的安装 及配置!!!
创建用户用来远程连接
GRANT ALL PRIVILEGES ON *.* TO 'userName'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;flush privileges;
- 64位Aliyun Linux 15.1安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
- 64位centos6.7安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
- 64位centos6.7安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
- 64位centos6.7安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
- 64位centos6.7安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
- 64位centos6安装mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
- 64位centos7安装mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
- 安装 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
- centos6.5安装mysql-advanced-5.7.9-linux-glibc2.5-x86_64.tar.gz为mysql service
- mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装
- mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装
- MySql(30)------linux下安装mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz(centos)
- linux 安装 mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
- linux下安装mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
- 【Mysql】Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
- Linux CenterOS安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
- Linux CenterOS6/rhel6安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
- cenos安装mysql(mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz)
- 通达OA如何让用户强行下线
- 我欠的那笔软件钱
- R语言服务器程序 Rserve详解
- 实验一的第二个又叫并集。
- Java stack test
- 64位Aliyun Linux 15.1安装mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
- 《计算机技术领域当前的主流技术及其社会需求调查报告》
- SpringSecurity初识
- 排名函数(ROW_NUMBER、RANK、DENSE_RANK)及OVER子句
- gradle批量打包Android apk:不同的包使用不同的icon、label
- vs2013中如何打开asp.net配置页面
- Ebay架构特点(HPTS 2009)
- android 5.0新特性,recyclerview的基本用法,及应注意的问题
- Android调用JNI的进阶实例(摄像头预览数据转码RGB播放)