Ubuntu下安装MySQL 5.6.23

1.下载相应Linux-generic的源代码包。解压,将解压后的文件夹重命名为mysql。移动到/usr/local文件夹下;

tar –xzf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql

sudo mv mysql /usr/local

2.创建用户mysql和组mysql

[email protected]: sudo groupadd mysql

[email protected]:  sudo useradd -r -g mysql mysql

3、进入mysql文件夹

[email protected]:  sudo cd /usr/local/mysql

4、将mysql目录own及grp变更为mysql

[email protected]:/usr/local/mysql$ sudo chown -R mysql .

[email protected]:/usr/local/mysql$ sudo chgrp -R mysql .

5、运行mysql安装脚本,设置用户

[email protected]:/usr/local/mysql$ sudo ./scripts/mysql_install_db --user=mysql

Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

[email protected]:/usr/local/mysql$ sudo apt-get install libaio-dev

(..........)

[email protected]:/usr/local/mysql$ sudo ./scripts/mysql_install_db --user=mysql

Installing MySQL system tables...2015-03-18 21:22:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-03-18 21:22:46 5284 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-03-18 21:22:46 5284 [Note] InnoDB: The InnoDB memory heap is disabled

2015-03-18 21:22:46 5284 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-03-18 21:22:46 5284 [Note] InnoDB: Memory barrier is not used

2015-03-18 21:22:46 5284 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-03-18 21:22:46 5284 [Note] InnoDB: Using Linux native AIO

2015-03-18 21:22:46 5284 [Note] InnoDB: Using CPU crc32 instructions

2015-03-18 21:22:46 5284 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-03-18 21:22:46 5284 [Note] InnoDB: Completed initialization of buffer pool

2015-03-18 21:22:46 5284 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2015-03-18 21:22:46 5284 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2015-03-18 21:22:46 5284 [Note] InnoDB: Database physically writes the file full: wait...

2015-03-18 21:22:46 5284 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2015-03-18 21:22:46 5284 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2015-03-18 21:22:47 5284 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2015-03-18 21:22:47 5284 [Warning] InnoDB: New log files created, LSN=45781

2015-03-18 21:22:47 5284 [Note] InnoDB: Doublewrite buffer not found: creating new

2015-03-18 21:22:47 5284 [Note] InnoDB: Doublewrite buffer created

2015-03-18 21:22:47 5284 [Note] InnoDB: 128 rollback segment(s) are active.

2015-03-18 21:22:47 5284 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-03-18 21:22:47 5284 [Note] InnoDB: Foreign key constraint system tables created

2015-03-18 21:22:47 5284 [Note] InnoDB: Creating tablespace and datafile system tables.

2015-03-18 21:22:47 5284 [Note] InnoDB: Tablespace and datafile system tables created.

2015-03-18 21:22:47 5284 [Note] InnoDB: Waiting for purge to start

2015-03-18 21:22:48 5284 [Note] InnoDB: 5.6.23 started; log sequence number 0

2015-03-18 21:22:52 5284 [Note] Binlog end

2015-03-18 21:22:52 5284 [Note] InnoDB: FTS optimize thread exiting.

2015-03-18 21:22:52 5284 [Note] InnoDB: Starting shutdown...

2015-03-18 21:22:53 5284 [Note] InnoDB: Shutdown completed; log sequence number 1625977

OK

Filling help tables...2015-03-18 21:22:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-03-18 21:22:53 5307 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-03-18 21:22:53 5307 [Note] InnoDB: The InnoDB memory heap is disabled

2015-03-18 21:22:53 5307 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-03-18 21:22:53 5307 [Note] InnoDB: Memory barrier is not used

2015-03-18 21:22:53 5307 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-03-18 21:22:53 5307 [Note] InnoDB: Using Linux native AIO

2015-03-18 21:22:53 5307 [Note] InnoDB: Using CPU crc32 instructions

2015-03-18 21:22:53 5307 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-03-18 21:22:53 5307 [Note] InnoDB: Completed initialization of buffer pool

2015-03-18 21:22:53 5307 [Note] InnoDB: Highest supported file format is Barracuda.

2015-03-18 21:22:53 5307 [Note] InnoDB: 128 rollback segment(s) are active.

2015-03-18 21:22:53 5307 [Note] InnoDB: Waiting for purge to start

2015-03-18 21:22:53 5307 [Note] InnoDB: 5.6.23 started; log sequence number 1625977

2015-03-18 21:22:53 5307 [Note] Binlog end

2015-03-18 21:22:53 5307 [Note] InnoDB: FTS optimize thread exiting.

2015-03-18 21:22:53 5307 [Note] InnoDB: Starting shutdown...

2015-03-18 21:22:55 5307 [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 de16-C6100 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 at http://bugs.mysql.com/

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

WARNING: Found existing config file ./my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as ./my-new.cnf,

please compare it with your file and take the changes you need.

6.上述步骤安装完毕后。把该文件夹的全部权变更回来,除了data文件夹能够供我们普通用户操作。

[email protected]:/usr/local/mysql$ sudo chown -R root .

[email protected]:/usr/local/mysql$ sudo chown -R mysql data

7. 能够改变默认配置文件的位置;

[email protected]:/usr/local/mysql$ sudo cp support-files/my-default.cnf /etc/my.cnf

8.后台启动mysql server;

[email protected]:/usr/local/mysql$ sudo bin/mysqld_safe --user=mysql &

[1] 5375

[email protected]:/usr/local/mysql$ 150318 21:29:24 mysqld_safe Logging to ‘/usr/local/mysql/data/de16-C6100.err‘.

150318 21:29:24 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

9. 设置MySQL root权限的password;

[email protected]:/usr/local/mysql$ sudo bin/mysqladmin -u root password ‘你的密码‘

Warning: Using a password on the command line interface can be insecure.

10. 把运行脚本移到init.d文件夹下;

[email protected]:/usr/local/mysql$ sudo cp support-files/mysql.server /etc/init.d/mysql.server

11.此时能够查看执行状态。能够用service命令的status/start/stop/restart控制。

[email protected]:/usr/local/mysql$ sudo service mysql.server status

* MySQL running (5477)

12.设置开机启动(就是插入到那些开机会自己主动执行的脚本中),取消自启动的话defaults -> remove ;

[email protected]:/usr/local/mysql$ sudo update-rc.d mysql.server defaults

Adding system startup for /etc/init.d/mysql.server ...

/etc/rc0.d/K20mysql.server -> ../init.d/mysql.server

/etc/rc1.d/K20mysql.server -> ../init.d/mysql.server

/etc/rc6.d/K20mysql.server -> ../init.d/mysql.server

/etc/rc2.d/S20mysql.server -> ../init.d/mysql.server

/etc/rc3.d/S20mysql.server -> ../init.d/mysql.server

/etc/rc4.d/S20mysql.server -> ../init.d/mysql.server

/etc/rc5.d/S20mysql.server -> ../init.d/mysql.server

13.搞个符号连接,方便命令的输入(这个有用程序是用来连接到MySQL server的client程序(CLI));

[email protected]:/usr/local/mysql$ sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

14. 此时,就依照好了。能够简单測试下。

[email protected]:/usr/local/mysql$ mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.23 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 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 |

| test               |

+--------------------+

2 rows in set (0.00 sec)

mysql> exit

Bye

时间: 2024-10-05 20:36:25

Ubuntu下安装MySQL 5.6.23的相关文章

ubuntu下安装mysql出现FATAL ERROR: Could not find mysqld的处理

ubuntu下安装mysql出现FATAL ERROR: Could not find mysqld的处理 错误信息: #./bin/mysql_install_db –user=mysql FATAL ERROR: Could not find mysqld The following directories were searched: /usr/libexec /usr/sbin /usr/bin If you compiled from source, you need to run '

Ubuntu下安装MySql并在外网连接

纯新手教程. 1.安装mysql apt-get install mysql-server mysql-client libmysqlclient15-dev 安装过程中会提示为数据库root账户设置密码,输入两边密码即可 2.进入 mysql mysql -uroot -p 3.重新设置mysql用户root的密码 GRANT ALL PRIVILEGES ON *.* TO [email protected] IDENTIFIED BY "123456"; 4.创建新数据库 pro

Ubuntu下安装MySQL

在Linux下安装MySQL有三种方式:第一种以rpm的二进制文件分个安装,第二种是自己编译源码后安装,最后一种是以二进制tar.gz文件来安装. 这三种中,由于最后一种是统一的整体文件,个人感觉最简单,故本文将采用此方式来进行安装: 首先到mysql的下载中心上下载最新的tar.gz包: 1.在浏览器中输入http://www.mysql.com/downloads/,进入mysql的下载中心,在这里有使用mysql开发的一些工具,包括mysql的驱动,数据库以及图形开发工具MySQL Wor

Ubuntu下安装mysql和mysql-python

ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client 3.  sudo apt-get install libmysqlclient-dev 安装过程中会提示设置密码什么的,注意设置了不要忘了,安装完成之后可以使用如下命令来检查是否安装成功: sudo netstat -tap | grep mysql 通过上述命令检查之后,如果看到有mysql 的

Ubuntu下安装MySQL 并配置root账号远程访问

# 查看有没有安装MySQL: dpkg -l | grep mysql # 安装MySQL: apt install mysql-server 安装完成之后可以使用如下命令来检查是否安装成功: netstat -tap | grep mysql 通过上述命令检查之后,如果看到有 mysql 的socket处于 LISTEN 状态则表示安装成功. 登录mysql数据库可以通过如下命令: mysql -u root -p -u 表示选择登陆的用户名, -p 表示登陆的用户密码,现在是mysql数据

Ubuntu下安装MySQL及简单操作

Ubuntu上安装MySQL非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client 3.  sudo apt-get install libmysqlclient-dev 安装过程中会提示设置密码什么的,注意设置了不要忘了,安装完成之后可以使用如下命令来检查是否安装成功: sudo netstat -tap | grep mysql 通过上述命令检查之后,如果看到有mysql 的

Ubuntu下安装mysql的方法

前 言 因为配置HQueue渲染集群首先需要安装mysql,所以今天分享一下如何在Ubuntu中安装: Ubuntu中安装开发类的软件非常方便,根本不需要到mysql以及Apache的官网下载文件,因为Ubuntu的软件源已经集成了所需的软件包,直接用命令行获取安装即可- 不过在安装mysql之前,请确保已经安装了Apache,如果没有安装,点击查看Apache的安装: mysql 安装过程 首先按Ctrl+Alt+T打开终端: 输入 sudo apt-get install mysql-ser

ubuntu下安装mysql及卸载mysql方法

1. 删除mysql a. sudo apt-get autoremove --purge mysql-server-5.0 b. sudo apt-get remove mysql-server c. sudo apt-get autoremove mysql-server d. sudo apt-get remove mysql-common (非常重要) 上面的其实有一些是多余的,建议还是按照顺序执行一遍 2. 清理残留数据 dpkg -l |grep ^rc|awk '{print $2

Ubuntu下安装Mysql并使用

一.在Ubuntu终端中输入 sudo apt-get install mysql-server 二.在安装中要设置root密码,自己输入即可,但必须要记住. 三.安装后可以使用命令检测是安装成功 sudo netstat -tap|grep mysql 四. 用root登录Mysql输入 sudo mysql  -u root -p 解释: -u:指定你要使用那个数据库用户登录,才安装的时候我们只设置了root密码,只知道有root用户,所以使用root -p:指定密码,不要再-p后面直接输入