MySQL5.6_Linux安装
mysql 5.6安装
1.1.1安装MySQL5.6文件下载:10.45.15.23 tnms/Tnms@2018/home/tnms/mysql-5.6.12-linux-glibc2.5-x86_64.tar --安装包/home/tnms/f --配置文件a) 准备工作创建mysql用户[root@centos /]# useradd -s /sbin/nologin -M mysql文件上传opt路径下解压文件[root@centos opt]# gunzip mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz [root@centos opt]# tar -xvf mysql-5.6.37-linux-glibc2.12-x86_64.tar重命名为mysql[root@centos opt]# mv mysql-5.6.37-linux-glibc2.12-x86_64 mysql b) 文件配置f文件复制[root@centos opt]# cp /opt/mysql/support-files/f /etc/f •编辑/etc/f#二进制安装,默认配置文件在/etc/f[root@centos opt]# vi /etc/f清空f里面内容,将以下内容粘贴进去[client]port = 3306socket = /opt/mysql/mysql.sock[mysql]#这个配置段设置启动MySQL服务的条件;在这种情况下,no-auto-rehash确保这个服务启动得比较快。
no-auto-rehashport=3306default-character-set=utf8[mysqld]character-set-server = utf8user = mysqlport = 3306socket = /opt/mysql/mysql.sockbasedir = /opt/mysqldatadir = /opt/mysql/dataopen_files_limit = 10240server_id = 10back_log = 600#在MYSQL暂时停止响应新请求之前,短时间内的多少个请求可以被存在堆栈中。
linuxCentOS6.5yum安装mysql5.6
linuxCentOS6.5yum安装mysql5.6本⽂为⼤家分享了linux yum安装mysql5.6简单过程,供⼤家参考,具体内容如下1.新开的云服务器,需要检测系统是否⾃带安装mysql# yum list installed | grep mysql2.如果发现有系统⾃带mysql,果断这么⼲# yum -y remove mysql-libs.x86_643.随便在你存放⽂件的⽬录下执⾏,这⾥解释⼀下,由于这个mysql的yum源服务器在国外,所以下载速度会⽐较慢,还好mysql5.6只有79M⼤,⽽mysql5.7就有182M了,所以这是我不想安装mysql5.7的原因# wget /mysql-community-release-el6-5.noarch.rpm4.接着执⾏这句,解释⼀下,这个rpm还不是mysql的安装⽂件,只是两个yum源⽂件,执⾏后,在/etc/yum.repos.d/ 这个⽬录下多出mysql-community-source.repo和mysql-community.repo# rpm -ivh mysql-community-release-el6-5.noarch.rpm5.这个时候,可以⽤yum repolist mysql这个命令查看⼀下是否已经有mysql可安装⽂件#yum repolist all | grep mysql6.安装mysql 服务器命令(⼀路yes):# yum install mysql-community-server7.安装成功后# service mysqld start8.由于mysql刚刚安装完的时候,mysql的root⽤户的密码默认是空的,所以我们需要及时⽤mysql的root⽤户登录(第⼀次回车键,不⽤输⼊密码),并修改密码# mysql -u root# use mysql;# update user set password=PASSWORD("这⾥输⼊root⽤户密码") where User='root';# flush privileges;9.查看mysql是否⾃启动,并且设置开启⾃启动命令# chkconfig --list | grep mysqld# chkconfig mysqld on10.mysql安全设置(系统会⼀路问你⼏个问题,看不懂复制之后翻译,基本上⼀路yes):# mysql_secure_installation以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
5.6版本MySQL的下载、安装及配置过程
下载及安装MySQL自MySQL版本升级到5.6以后,其安装及配置过程和原来版本发生了很大的变化,下面详细介绍5.6版本MySQL的下载、安装及配置过程。
图1.1 MySQL5.6目前针对不同用户,MySQL提供了2个不同的版本:MySQL Community Server:社区版,该版本完全免费,但是官方不提供技术支持。
MySQL Enterprise Server:企业版,它能够高性价比的为企业提供数据仓库应用,支持ACID事物处理,提供完整的提交、回滚、崩溃恢复和行级锁定功能。
但是该版本需付费使用,官方提供电话及文档等技术支持。
目前最新的MySQL版本为MySQL 5.6,可以在官方网站(/downloads/)上面下载该软件。
在下图1.2所示的MySQL官网上单击右下角的“MySQL Installer 5.6”超链接,然后按照提示一步步操作就可以将MySQL软件下载到本地计算机中了。
注意这里我们选择的是数据库版本是“Windows (x86, 32-bit), MSI Installer”,如下图1.3所示。
图1.2 MySQL官方网站图1.3 选择MySQL版本MySQL下载完成后,找到下载到本地的文件,按照下面所示的步骤双击进行安装:步骤1:双击MySQL安装程序(mysql-installer-community-5.6.10.1),会弹出如下图1.4所示的欢迎窗口。
图1.4 MySQL欢迎界面步骤2:单击图1.4中的“Install MySQL Products”文字,会弹出的用户许可证协议窗口,如下图1.5所示。
图1.5 用户许可证协议窗口步骤3:选中“I accept the license terms”的前面的选择框,然后点击【Next】按钮,会进入查找最新版本界面,效果如下图1.6所示:图1.6 查找最新版本窗口步骤4:单击【Execute】按钮,会进入安装类型设置界面,效果如下图1.7所示。
Linux下安装及配置MySQL详细过程(自己实践总结)
Red Hat Linux下安装及配置MySQL的详细教程大致思路如下:1.下载所需的安装包(Linux下用wget下载,笔者在window下下载的,用XSHELL命令RZ上传到Linux中)2.安装MySQL3.创建新用户并授权安装及配置的详细步骤如下:第一步:检测系统版本信息Linux命令: cat /proc/versionLinux version 2.6.32-220.el6.i686 (mockbuild@) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Wed Nov 9 08:02:18 EST 2011当前Linux版本为RedHat 4.4.5-6(为内核版本)Linux命令:cat /etc/issueRed Hat Enterprise Linux Server release 6.2 (Santiago)Kernel \r on an \mLinux命令: uname -a 或getconf LONG_BITLinux localhost.localdomain 2.6.32-220.el6.i686 #1 SMP Wed Nov 9 08:02:18 EST 2011 i686 i686 i386 GNU/Linux可以看到当前系统为32位的(而64位系统会有x64字符串显示出来)。
第二步:根据Linux系统的环境,下载mysql Community Server官方下载地址: /downloads/mysql/可以选择【Linux-Generic】,下载对应的RMP包.由于当前系统为redhat(64位),所以直接选择Oracle &Red Hat Linux 4 & 5。
Mysql安装包有很多,作用也不同,大多数情况下只需要安装MySQL-Server和MySQL-Client,其它包根据需要安装.32位的下载下面的两个安装包文件:MySQL-server-5.6.11-2.linux_glibc2.5.i386.rpmMySQL-client-5.6.11-2.linux_glibc2.5.i386.rpm(而64位下载下面两个安装包文件:MySQL-server-5.6.11-2.linux_glibc2.5.x86_64.rpmMySQL-client-5.6.11-2.linux_glibc2.5.x86_64.rpm)第三步: 安装MySQL安装顺序: 先安装服务器,然后再安装客户端。
mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装
mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz下载系统版本:[vb]view plain copyprint?1.[mysql@localhost scripts]$ uname -a2.Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26UTC 2013 x86_64 x86_64 x86_64 GNU/Linux解压:[vb]view plain copyprint?1.[root@localhost mysql]# tar -zxf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz -C /usr/local/创建mysql用户:[vb]view plain copyprint?1.[root@localhost mysql]# useradd mysql设置mysql用户密码:[vb]view plain copyprint?1.[root@localhost mysql]# echo '123456'|passwd --stdin mysql设置权限:[vb]view plain copyprint?1.[root@localhost mysql]# cd /usr/local[vb]view plain copyprint?1.[root@localhost local]# chown -R mysql:mysql mysql/切换到mysql用户[vb]view plain copyprint?1.[root@localhost local]# su - mysql[vb]view plain copyprint?1.[mysql@localhost ~]$ cd /usr/local/mysql/scripts/安装:[vb]view plain copyprint?1.[mysql@localhost scripts]$ /usr/local/mysql/scripts/mysql_install_db--user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &输出信息:[vb]view plain copyprint?1.[mysql@localhost scripts]$ /usr/local/mysql/scripts/mysql_install_db--user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &2.Installing MySQL system tables...2016-04-17 07:41:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for _timestamp server option (see documentation for more details).3.2016-04-17 07:41:40 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.30) starting as process 3394 ...4.2016-04-17 07:41:40 3394 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)5.6.2016-04-17 07:41:40 3394 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)7.8.2016-04-17 07:41:40 3394 [Note] InnoDB: Using atomics to ref count buffer pool pages9.2016-04-17 07:41:40 3394 [Note] InnoDB: The InnoDB memory heap is disabled10.2016-04-17 07:41:40 3394 [Note] InnoDB: Mutexes and rw_locks use GCC atomicbuiltins11.2016-04-17 07:41:40 3394 [Note] InnoDB: Memory barrier is not used12.2016-04-17 07:41:40 3394 [Note] InnoDB: Compressed tables use zlib 1.2.313.2016-04-17 07:41:40 3394 [Note] InnoDB: Using Linux native AIO14.2016-04-17 07:41:40 3394 [Note] InnoDB: Using CPU crc32 instructions15.2016-04-17 07:41:40 3394 [Note] InnoDB: Initializing buffer pool, size = 128.0M16.2016-04-17 07:41:40 3394 [Note] InnoDB: Completed initialization of buffer pool17.2016-04-17 07:41:41 3394 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!18.2016-04-17 07:41:41 3394 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB19.2016-04-17 07:41:41 3394 [Note] InnoDB: Database physically writes the filefull: wait...20.2016-04-17 07:41:41 3394 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB21.2016-04-17 07:41:42 3394 [Note] InnoDB: Setting log file ./ib_logfile1 sizeto 48 MB22.2016-04-17 07:41:44 3394 [Note] InnoDB: Renaming log file ./ib_logfile101 to./ib_logfile023.2016-04-17 07:41:44 3394 [Warning] InnoDB: New log files created, LSN=4578124.2016-04-17 07:41:44 3394 [Note] InnoDB: Doublewrite buffer not found: creating new25.2016-04-17 07:41:44 3394 [Note] InnoDB: Doublewrite buffer created26.2016-04-17 07:41:44 3394 [Note] InnoDB: 128 rollback segment(s) are active.27.2016-04-17 07:41:44 3394 [Warning] InnoDB: Creating foreign key constraint system tables.28.2016-04-17 07:41:44 3394 [Note] InnoDB: Foreign key constraint system tablescreated29.2016-04-17 07:41:44 3394 [Note] InnoDB: Creating tablespace and datafile system tables.30.2016-04-17 07:41:44 3394 [Note] InnoDB: Tablespace and datafile system tables created.31.2016-04-17 07:41:44 3394 [Note] InnoDB: Waiting for purge to start32.2016-04-17 07:41:44 3394 [Note] InnoDB: 5.6.30 started; log sequence number33.2016-04-17 07:41:45 3394 [Note] Binlog end34.2016-04-17 07:41:45 3394 [Note] InnoDB: FTS optimize thread exiting.35.2016-04-17 07:41:45 3394 [Note] InnoDB: Starting shutdown...36.2016-04-17 07:41:46 3394 [Note] InnoDB: Shutdown completed; log sequence number 162597737.OK38.39.Filling help tables...2016-04-17 07:41:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).40.2016-04-17 07:41:46 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.30) starting as process 3417 ...41.2016-04-17 07:41:46 3417 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)43.2016-04-17 07:41:46 3417 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)44.45.2016-04-17 07:41:46 3417 [Note] InnoDB: Using atomics to ref count buffer pool pages46.2016-04-17 07:41:46 3417 [Note] InnoDB: The InnoDB memory heap is disabled47.2016-04-17 07:41:46 3417 [Note] InnoDB: Mutexes and rw_locks use GCC atomicbuiltins48.2016-04-17 07:41:46 3417 [Note] InnoDB: Memory barrier is not used49.2016-04-17 07:41:46 3417 [Note] InnoDB: Compressed tables use zlib 1.2.350.2016-04-17 07:41:46 3417 [Note] InnoDB: Using Linux native AIO51.2016-04-17 07:41:46 3417 [Note] InnoDB: Using CPU crc32 instructions52.2016-04-17 07:41:46 3417 [Note] InnoDB: Initializing buffer pool, size = 128.0M53.2016-04-17 07:41:46 3417 [Note] InnoDB: Completed initialization of buffer pool54.2016-04-17 07:41:46 3417 [Note] InnoDB: Highest supported file format is Barracuda.55.2016-04-17 07:41:46 3417 [Note] InnoDB: 128 rollback segment(s) are active.56.2016-04-17 07:41:46 3417 [Note] InnoDB: Waiting for purge to start57.2016-04-17 07:41:46 3417 [Note] InnoDB: 5.6.30 started; log sequence number162597758.2016-04-17 07:41:46 3417 [Note] Binlog end59.2016-04-17 07:41:46 3417 [Note] InnoDB: FTS optimize thread exiting.60.2016-04-17 07:41:46 3417 [Note] InnoDB: Starting shutdown...61.2016-04-17 07:41:48 3417 [Note] InnoDB: Shutdown completed; log sequence number 162598762.OK63.64.To start mysqld at boot time you have to copy65.support-files/mysql.server to the right place for your system66.67.PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !68.To do so, start the server, then issue the following commands:69.70. /usr/local/mysql/bin/mysqladmin -u root password 'new-password'71. /usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password'new-password'72.73.Alternatively you can run:74.75. /usr/local/mysql/bin/mysql_secure_installation77.which will also give you the option of removing the test78.databases and anonymous user created by default. This is79.strongly recommended for production servers.80.81.See the manual for more instructions.82.83.You can start the MySQL daemon with:84.85. cd . ; /usr/local/mysql/bin/mysqld_safe &86.87.You can test the MySQL daemon with mysql-test-run.pl88.89. cd mysql-test ; perl mysql-test-run.pl90.91.Please report any problems at /92.93.The latest information about MySQL is available on the web at94.95. 96.97.Support MySQL by buying support/licenses at 98.99.New default config file was created as /usr/local/mysql/f and100.will be used by default by the server when you start it.101.You may edit this file to change server settings102.103.WARNING: Default config file /etc/f exists on the system104.This file will be read by default by the MySQL server105.If you do not want to use this, either remove it, or use the106.--defaults-file argument to mysqld_safe when starting the server这里可能会报错:scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory。
linux下MySQL安装登录及操作
linux下MySQL安装登录及操作二、安装Mysql1、下载MySQL的安装文件安装MySQL需要下面两个文件:MySQL-server-4.0.16-0.i386.rpmMySQL-client-4.0.16-0.i386.rpm下载地址为:/downloads/mysql-4.0.html,打开此网页,下拉网页找到“Linux x86 RPM downloads”项,找到“Server”和“Client programs”项,下载需要的上述两个rpm文件。
2、安装MySQLrpm文件是Red Hat公司开发的软件安装包,rpm可让Linux在安装软件包时免除许多复杂的手续。
该命令在安装时常用的参数是–ivh ,其中i表示将安装指定的rmp软件包,V表示安装时的详细信息,h表示在安装期间出现“#”符号来显示目前的安装过程。
这个符号将持续到安装完成后才停止。
1)安装服务器端在有两个rmp文件的目录下运行如下命令:[root@test1 local]# rpm -ivh MySQL-server-4.0.16-0.i386.rpm显示如下信息。
warning: MySQL-server-4.0.16-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5Preparing...########################################### [100%]1:MySQL-server########################################### [100%]。
(省略显示)/usr/bin/mysqladmin -u root password 'new-password'/usr/bin/mysqladmin -u root -h test1 password 'new-password'。
CentOS 6.0安装MySQL 5.6及配置
CentOS 6.0安装MySQL 5.6及配置从今年3月份开始mysql官网开始发布相关的5.6系列的各个版本,对于mysql5.6系列的版本对一起的版本进行了全局性的细节性加强;个人感觉,以下是在虚拟机中配置的mysql5.6.10源码安装的过程分享记录下:一、必要软件包安装:[root@mysql5~]#yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurse s-devel libmcrypt* libtool-ltdl-devel* make cmake二、编译安装:[root@mysql5 ~]# groupadd mysql[root@mysql5 ~]# useradd -r -g mysql mysql[root@mysql5 ~]# lsanaconda-ks.cfg install.log install.log.syslog mysql-5.6.10.tar.gz[root@mysql5 ~]# cd /usr/local/[root@mysql5 local]# lsbin etc games include lib libexec sbin share src[root@mysql5 local]# cp /root/mysql-5.6.10.tar.gz /usr/local/[root@mysql5 local]# lltotal 34468drwxr-xr-x 2 root root 4096 Jan 27 2010 bindrwxr-xr-x 2 root root 4096 Jan 27 2010 etcdrwxr-xr-x 2 root root 4096 Jan 27 2010 gamesdrwxr-xr-x 2 root root 4096 Jan 27 2010 includedrwxr-xr-x 2 root root 4096 Jan 27 2010 libdrwxr-xr-x 2 root root 4096 Jan 27 2010 libexec-rw-r--r-- 1 root root 35174149 Apr 17 00:55 mysql-5.6.10.tar.gzdrwxr-xr-x 2 root root 4096 Jan 27 2010 sbindrwxr-xr-x 4 root root 4096 Apr 17 00:32 sharedrwxr-xr-x 2 root root 4096 Jan 27 2010 src[root@mysql5 local]# tar -zxvf mysql-5.6.10.tar.gz[root@mysql5 local]# cd mysql-5.6.10[root@mysql5 local]# cmake . ###编译报如下错误暂不管[ 63%] Building CXX object sql/CMakeFiles/sql.dir/sql_.o/root/mysql-5.6.13/sql/sql_: In member function ‘void Optimize_table_order::best_access_path(JOIN_TAB*, table_map, uint, bool, double, POSITION*, POSITION*)’:/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_start_key’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_max_loose_keypart’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_records’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_key’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::quick_max_loose_keypart’may be used uninitialized in this function[root@mysql5 local]# make && make install三、配置MySQL[root@mysql5 mysql-5.6.10]# chown -R mysql.mysql /usr/local/mysql[root@mysql5 mysql-5.6.10]#[root@mysql5 mysql-5.6.10]# cd /usr/local/mysql/scripts/[root@mysql5 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/dataInstalling MySQL system tables...2013-04-17 01:26:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2013-04-17 01:26:58 18715 [Note] InnoDB: The InnoDB memory heap is disabled2013-04-17 01:26:58 18715 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation2013-04-17 01:26:58 18715 [Note] InnoDB: Compressed tables use zlib 1.2.32013-04-17 01:26:58 18715 [Note] InnoDB: CPU does not support crc32 instructions2013-04-17 01:26:58 18715 [Note] InnoDB: Initializing buffer pool, size = 128.0M2013-04-17 01:26:58 18715 [Note] InnoDB: Completed initialization of buffer pool2013-04-17 01:26:58 18715 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2013-04-17 01:26:59 18715 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2013-04-17 01:26:59 18715 [Note] InnoDB: Database physically writes the file full: wait...2013-04-17 01:26:59 18715 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2013-04-17 01:26:59 18715 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2013-04-17 01:26:59 18715 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2013-04-17 01:26:59 18715 [Warning] InnoDB: New log files created, LSN=457812013-04-17 01:26:59 18715 [Note] InnoDB: Doublewrite buffer not found: creating new2013-04-17 01:26:59 18715 [Note] InnoDB: Doublewrite buffer created2013-04-17 01:26:59 18715 [Note] InnoDB: 128 rollback segment(s) are active.2013-04-17 01:26:59 18715 [Warning] InnoDB: Creating foreign key constraint system tables. 2013-04-17 01:26:59 18715 [Note] InnoDB: Foreign key constraint system tables created2013-04-17 01:26:59 18715 [Note] InnoDB: Creating tablespace and datafile system tables. 2013-04-17 01:26:59 18715 [Note] InnoDB: Tablespace and datafile system tables created.2013-04-17 01:26:59 18715 [Note] InnoDB: Waiting for purge to start2013-04-17 01:26:59 18715 [Note] InnoDB: 1.2.10 started; log sequence number 02013-04-17 01:26:59 18715 [Note] Binlog end2013-04-17 01:26:59 18715 [Note] InnoDB: FTS optimize thread exiting.2013-04-17 01:26:59 18715 [Note] InnoDB: Starting shutdown...2013-04-17 01:27:00 18715 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OKFilling help tables...2013-04-17 01:27:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2013-04-17 01:27:00 18738 [Note] InnoDB: The InnoDB memory heap is disabled2013-04-17 01:27:00 18738 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation2013-04-17 01:27:00 18738 [Note] InnoDB: Compressed tables use zlib 1.2.32013-04-17 01:27:00 18738 [Note] InnoDB: CPU does not support crc32 instructions2013-04-17 01:27:00 18738 [Note] InnoDB: Initializing buffer pool, size = 128.0M2013-04-17 01:27:00 18738 [Note] InnoDB: Completed initialization of buffer pool2013-04-17 01:27:00 18738 [Note] InnoDB: Highest supported file format is Barracuda.2013-04-17 01:27:00 18738 [Note] InnoDB: 128 rollback segment(s) are active.2013-04-17 01:27:00 18738 [Note] InnoDB: Waiting for purge to start2013-04-17 01:27:01 18738 [Note] InnoDB: 1.2.10 started; log sequence number 16259772013-04-17 01:27:01 18738 [Note] Binlog end2013-04-17 01:27:01 18738 [Note] InnoDB: FTS optimize thread exiting.2013-04-17 01:27:01 18738 [Note] InnoDB: Starting shutdown...2013-04-17 01:27:02 18738 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/local/mysql/bin/mysqladmin -u root password 'new-password'/usr/local/mysql/bin/mysqladmin -u root -h mysql5.6 password 'new-password'Alternatively you can run:/usr/local/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd . ; /usr/local/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script!The latest information about MySQL is available on the web at Support MySQL by buying support/licenses at New default config file was created as /usr/local/mysql/f and will be used by default by the server when you start it.You may edit this file to change server settingsWARNING: Default config file /etc/f exists on the systemThis file will be read by default by the MySQL serverIf you do not want to use this, either remove it, or use the--defaults-file argument to mysqld_safe when starting the server[root@mysql5 scripts]#[root@mysql5 scripts]# cd /usr/local/mysql/support-files/[root@mysql5 support-files]# cp mysql.server /etc/rc.d/init.d/mysql cp: overwrite `/etc/rc.d/init.d/mysql'? y[root@mysql5 support-files]# cp f /etc/fcp: overwrite `/etc/f'? y[root@mysql5 support-files]#[root@mysql5 support-files]# chkconfig -add mysql-add: unknown option[root@mysql5 support-files]# chkconfig --add mysql[root@mysql5 support-files]# chkconfig mysql on[root@mysql5 support-files]# service mysql startStarting MySQL. [ OK ] [root@mysql5 support-files]#[root@mysql5 data]# mysql -u mysql -p -S /tmp/mysql.sockEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.10 Source distributionType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>mysql> status;--------------mysql Ver 14.12 Distrib 5.0.77, for RedHat-linux-gnu (i686) using readline 5.1Connection id: 1Current database:Current user: mysql@localhostSSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.6.10 Source distributionProtocol version: 10Connection: Localhost via UNIX socketServer characterset: latin1Db characterset: latin1Client characterset: latin1Conn. characterset: latin1UNIX socket: /tmp/mysql.sockUptime: 3 min 38 secThreads: 1 Questions: 5 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.022--------------mysql>四、远程登录及常用命令1、mysql服务的启动和停止net stop mysqlnet start mysql2、本地登陆mysql及远程登录语法如下:mysql -u用户名-p用户密码键入命令mysql –uroot -p,回车后提示你输入密码,输入12345,然后回车即可进入到mysql 中了,mysql的提示符是:mysql>注意,如果是连接到另外的机器上,则需要加入一个参数-h机器IP但被远程登录的mysql服务器需增加登录账号,方法如下:mysql>GRANT ALL PRIVILEGES ON*.* TO USER1@’%’ IDENTIFIED BY ’password’mysql>FLUSH PRIVILEGES;3、增加新用户格式:grant 权限on 数据库.* to 用户名@登录主机identified by "密码"如,增加一个用户user1密码为password1,让其可以在本机上登录,并对所有数据库有查询、插入、修改、删除的权限。
Linux离线安装mysql5.6详细步骤
Linux离线安装mysql5.6详细步骤⼀、安装MySQL1、下载安装包 mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz2、卸载系统⾃带的Mariadbrpm -qa|grep mariadb //查询已安装的mariadbrpm -e --nodeps ⽂件名//卸载,⽂件名为使⽤rpm -qa|grep mariadb 命令查出的所有⽂件3、删除etc⽬录下的f⽂件(如果没有就直接新建)rm /etc/f4、执⾏以下命令来创建mysql⽤户组groupadd mysql5、执⾏以下命令来创建⼀个⽤户名为mysql的⽤户并加⼊mysql⽤户组useradd -g mysql mysql6、将下载的⼆进制压缩包放到/usr/local/⽬录下。
7、解压安装包tar -zxvf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz8、将解压好的⽂件夹重命名为mysqlmv mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz mysql9、在etc下新建配置⽂件f,并在该⽂件内添加以下代码:[mysql]# 设置mysql客户端默认字符集default-character-set=utf8socket=/var/lib/mysql/mysql.sock[mysqld]skip-name-resolve#设置3306端⼝port=3306socket=/var/lib/mysql/mysql.sock# 设置mysql的安装⽬录basedir=/usr/local/mysql# 设置mysql数据库的数据的存放⽬录datadir=/usr/local/mysql/data# 允许最⼤连接数max_connections=200# 服务端使⽤的字符集默认为8⽐特编码的latin1字符集character-set-server=utf8# 创建新表时将使⽤的默认存储引擎default-storage-engine=INNODBlower_case_table_names=1max_allowed_packet=16M10、创建步骤9中⽤到的⽬录并将其⽤户设置为mysqlmkdir /var/lib/mysqlmkdir /var/lib/mysql/mysqlchown -R mysql:mysql /var/lib/mysqlchown -R mysql:mysql /var/lib/mysql/mysql11、进⼊安装mysql软件⽬录cd /usr/local/mysqlchown -R mysql:mysql ./ #修改当前⽬录拥有者为mysql⽤户./scripts/mysql_install_db --user=mysql #安装数据库chown -R mysql:mysql data #修改当前data⽬录拥有者为mysql⽤户到此数据库安装完成!⼆、配置MySQL1、授予f的最⼤权限。
linux下安装配置mysql
A、安装A.1、yum安装1.安装mysqlyum install mysql-server2.重启服务service mysqld restart3.开机启动chkconfig mysqld on4.卸载yum remove mysqlA.2、编译安装1.下载mysql安装包从官网(/downloads/)下载安装文件mysql-5.1.55.tar.gz2.解压tar zxvf mysql-5.1.55.tar.gz //减压缩cd mysql-5.1.55 //进入安装目录3.编译安装./configure --prefix=/usr/local/mysql --sysconfdir=/etc--localstatedir=/var/lib/Mysql/说明:prefix=/usr/local/mysql Mysql安装地目标目录sysconfdir=/etc my.ini配置文件地路径localstatedir=/var/lib/Mysql 数据库存放地路径make //编译make install //安装4.编译安装配置cp /usr/local/mysql-5.1.55/support-files/f /etc/ff这个文件很重要,它地路径是/etc/f,如果以前装过Mysql地话,可能需要更改配置5.启动mysql/usr/local/mysql/bin/mysqld_safe --user=mysql &如果启动不了地话那就是权限地问题,修改/var/lib/mysql地权限chown -R mysql:mysql /var/lib/Mysql6.在slackware下设置开机启动因为slackware已经有mysql的默认安装和开机配置文件,我们只需要修改为开机启动刚刚安装的mysql就可以。
cd /etc/rc.d进入slackware启动目录vi rc.mysqld修改httpd启动文件,把原默认路径改为/usr/local/mysql/bin就可以chchmod +x rc.mysqld增加可执行权限,这样rc.M启动文件就可以执行开启服务B、管理数据库密码B.1.设置初始密码初始数据库是没有密码的,可以运用下面命令给root设置密码。
ubuntu安装mysql5.6完整步骤说明(亲测实用)
1.进入mysql官网下载,选择需要的相应版本/downloads/mysql/或者直接迅雷下载这个文件:/archives/mysql-5.6/mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz单击MySQL Community Server选择相应的版本,这里选择5.6.16,linux版下载linux使用官方编译好的二进制包mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz2.上传mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz文件到linux的一个目录3.解压文件到当前目录4.复制解压后的mysql目录到系统本地目录/user/local中不存在mysql文件夹会自动创建5.添加系统mysql组和mysql用户:执行命令:groupadd mysql和useradd -r -g mysql mysql6.安装数据库进入安装mysql软件目录:执行命令cd /usr/local/mysql修改当前目录拥有者为mysql用户:执行命令chown -R mysql:mysql ./安装数据库:执行命令./scripts/mysql_install_db --user=mysql修改当前目录拥有者为root用户:执行命令chown -R root:root ./修改当前data目录拥有者为mysql用户:执行命令chown -R mysql:mysql data到此数据库安装完毕7. 启动mysql服务和添加开机启动mysql服务:添加开机启动:执行命令cp support-files/mysql.server /etc/init.d/mysql,把启动脚本放到开机初始化目录启动mysql服务:执行命令service mysql start执行命令:ps -ef|grep mysql 看到mysql服务说明启动成功,如图8. 修改mysql的root用户密码,root初始密码为空的:执行命令:./bin/mysqladmin -u root password '密码'9.把mysql客户端放到默认路径:ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql注意:建议使用软链过去,不要直接包文件复制,便于系统安装多个版本的mysql到此,mysql正式安装完毕,默认端口是330610.设置root用户允许远程连接。
CENTOS7环境安装MySQL5.6(rpm_二进制_源代码编译三种方式)
CENTOS7环境安装MySQL软件环境虚拟机:VMware® Workstation-10.0.1 build-1379776-Win Linux:Centos 7 X86_64MySQL Database: MySQL-5.6.24系统环境MySQL软件安装一、使用RPM安装。
安装采用RPM安装包安装。
下载mysql:/downloads/mysql/打开页面之后,在Select Platform:下选择linux Generic下载后的包为名称为:MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar(一)卸载原有MySQL或者Mariadb安装程序1、CentOs7版本默认情况下安装了mariadb-libs,必须先卸载才可以继续安装MySql。
a) 查找以前是否安装mariadb-libs# rpm -qa | grep -i mariadb-libsb)卸载已经安装的mariadb-libs# yum remove mariadb-libs-5.5.41-2.el7_0.x86_642、查找以前是否安装MySQL# rpm -qa | grep -i mysql--说明已经有安装了MySQL程序a)停止mysql服务# sudo service mysql stop或者:# ps -A | grep mysql# kill -9 进程号b)删除之前安装的mysql# rpm -ve MySQL-server-5.6.24-1.linux_glibc2.5.x86_64# rpm -ve MySQL-client-5.6.24-1.linux_glibc2.5.x86_64c)查找之前老版本mysql的目录、并且删除老版本mysql的文件和库# find / -name mysql【查找结果如下】# find / -name mysql/var/lib/mysql/usr/lib64/mysql/usr/local/mysql/usr/local/mysql/data/mysql【删除对应的目录】# rm -rf /var/lib/mysql# rm -rf /usr/lib64/mysql# rm -rf /usr/local/mysql【删除配置文档】# rm -rf /etc/fd)再次查找机器是否安装mysql# rpm -qa|grep -i mysql【无结果,说明已经卸载彻底、接下来直接安装mysql即可】(二)下载和解压、安装【创建一个任意名称文件夹,如:rpm】# mkdir rpm# cd rpm【下载安装包的压缩文档】# wget /Downloads/MySQL-5.6/MySQL-5.6.17-1.el6.x8 6_64.rpm-bundle.tar# tar –xvf MySQL-5.6.17-1.el6.x86_64.rpm-bundle.tar【创建mysql用户和数据目录】#groupadd mysql#useradd -r -g mysql mysql#cd /usr/local#sudo mkdir mysql#cd mysql#sudo mkdir mysql#sudo chown -R mysql .#sudo chgrp -R mysql .【安装RPM包】#sudo rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm如果出现错误:FATAL ERROR: please install the following Perl modules beforeexecuting ./scripts/mysql_install_db:Data::Dumper先用yum list 查找下module:# yum list|grep -i perl-modul*# yum install -y perl-Module-Install.noarch#rpm -ev MySQL-server-5.6.24-1.linux_glibc2.5.x86_64重新执行:#sudo rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm【初始化MySql配置文件】#cp f /etc/f可以简单修改配置如下。
Linux下安装MySQL
Linux下安装MySQL1. 下载进⼊Mysql下载官⽹,请点击:,在Product Version选项框中选择与⾃⼰本机对应的Mysql版本(这⾥我选择5.7.26),Operating System选项框中选择Linux - Generic2. 上传并解压这⾥博主习惯⽤rz命令上传,不习惯的可以使⽤WinSCP上传[root@localhost bin]# cd /[root@localhost /]# rz[root@localhost /]# cd /usr/local[root@localhost local]# tar -xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar3. 重命名[root@localhost local]# mv mysql-5.7.26-linux-glibc2.12-x86_64 mysql[root@localhost local]# cd mysql4. 创建mysql⽤户组和⽤户并修改权限[root@localhost local]# groupadd mysql[root@localhost local]# useradd -r -g mysql mysql5.创建数据⽬录并赋予权限[root@localhost local]# mkdir -p /data/mysql #创建⽬录[root@localhost local]# chown mysql:mysql -R /data/mysql #赋予权限6. 配置f[root@localhost local]# vim /etc/f内容如下:[mysqld]bind-address=0.0.0.0port=3306user=mysqlbasedir=/usr/local/mysqldatadir=/data/mysqlsocket=/tmp/mysql.socklog-error=/data/mysql/mysql.errpid-file=/data/mysql/mysql.pid#character configcharacter_set_server=utf8mb4symbolic-links=0explicit_defaults_for_timestamp=true7. 初始化数据库进⼊mysql的bin⽬录[root@localhost local]# cd /usr/local/mysql/bin/初始化[root@localhost bin]# ./mysqld --defaults-file=/etc/f --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize8. 查看密码最好将临时密码保存⼀下,接下来登录需要使⽤[root@localhost bin]# cat /data/mysql/mysql.err9.启动mysql,并更改root 密码[root@localhost bin]# service mysql start[root@localhost bin]# ps -ef|grep mysql这⾥可能会启动报错:mysqld: [ERROR] Found option without preceding group in config file /etc/f at line 1! mysqld: [ERROR] Fatal error in defaults handling. Program aborted!原因:配置⽂件出错,建议配置⽂件与我⼀致到这⾥表明mysql已经安装完成了10. 登录修改密码[root@localhost bin]# ./mysql -u root -p执⾏下⾯三步操作,然后重新登录。
linux下安装mysql(rpm文件安装)
linux下安装mysql(rpm⽂件安装)数据库包下载:在GPL开原协议的社区开源版⾥边下载我们⽤mysql community server⾥边的其中workbench是客户端⼯具MySQL Cluster是oracle⾃⼰搞的集群版的(集成了⼀些开源⼯具和增值服务)选择操作系统和版本建议在linux下安装也可以选择版本下载server包和client包如果是server包,那架构图⾥的东西都有了还要下个client utilities包,客户端包,类似connection层下载后⽤rz命令传到centos linux系统⾥边rpm是包管理器xshell可以直接拖也可以⽤rz命令,没有的话安装⼀下: yum install lrzszyum是包资源管理器,可以解决包依赖的问题,把需要的包都下载下来传到linux系统安装mysql步骤:清理环境centos7会⾃带⼀个mariadb查看是否已安装rpm -qa |grep -i mysqlrpm -qa |grep -i mariadb(centos7默认系统⾃带的)mariadb是从mysql来的,是它的⼀个分⽀,需要清理掉清理掉mariadb包⽤yum直接安装你的话,⽤的mariadb的yum源,它跟mysql官⽅正式版不太⼀样,我们要安装官⽅正式版,就需要清掉mariadb,然后⼿动安装⾃⼰下载的官⽅正式版mysqlrpm -e 加上包名,把mariadb包清掉可以看到⽤rpm删除会失败,提⽰有依赖关系的软件需要安装rpm -e mariadb-libs-5.5.56-2.el7.x86_64rpm删除时如果有依赖关系,可以⽤yum remove + 包名来删除mariadb开始安装:⼀般⽤装软件⽤yum直接安装也可以,但是有⼀个问题:⽤yum的话,是到默认的mariadb⽤的yum源去找,可能会找不到,所以我们⾃⼰来安装rpm –ivh + 包安装所需要的包rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpmrpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpmserver安装成功后会输出⼀些信息,如下:[root@localhost soft]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpmwarning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing...1:MySQL-server-5.6.42-1.el7 ################################# [100%]warning: user mysql does not exist - using rootwarning: group mysql does not exist - using rootwarning: user mysql does not exist - using rootwarning: group mysql does not exist - using root2018-11-18 13:53:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-11-18 13:53:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2018-11-18 13:53:24 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6420 ...2018-11-18 13:53:24 6420 [Note] InnoDB: Using atomics to ref count buffer pool pages2018-11-18 13:53:24 6420 [Note] InnoDB: The InnoDB memory heap is disabled2018-11-18 13:53:24 6420 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2018-11-18 13:53:24 6420 [Note] InnoDB: Memory barrier is not used2018-11-18 13:53:24 6420 [Note] InnoDB: Compressed tables use zlib 1.2.112018-11-18 13:53:24 6420 [Note] InnoDB: Using Linux native AIO2018-11-18 13:53:24 6420 [Note] InnoDB: Using CPU crc32 instructions2018-11-18 13:53:24 6420 [Note] InnoDB: Initializing buffer pool, size = 128.0M2018-11-18 13:53:24 6420 [Note] InnoDB: Completed initialization of buffer pool2018-11-18 13:53:24 6420 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2018-11-18 13:53:24 6420 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2018-11-18 13:53:24 6420 [Note] InnoDB: Database physically writes the file full: wait...2018-11-18 13:53:24 6420 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2018-11-18 13:53:25 6420 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2018-11-18 13:53:25 6420 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02018-11-18 13:53:25 6420 [Warning] InnoDB: New log files created, LSN=457812018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer not found: creating new2018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer created2018-11-18 13:53:25 6420 [Note] InnoDB: 128 rollback segment(s) are active.2018-11-18 13:53:25 6420 [Warning] InnoDB: Creating foreign key constraint system tables.2018-11-18 13:53:25 6420 [Note] InnoDB: Foreign key constraint system tables created2018-11-18 13:53:25 6420 [Note] InnoDB: Creating tablespace and datafile system tables.2018-11-18 13:53:25 6420 [Note] InnoDB: Tablespace and datafile system tables created.2018-11-18 13:53:25 6420 [Note] InnoDB: Waiting for purge to start2018-11-18 13:53:25 6420 [Note] InnoDB: 5.6.42 started; log sequence number 0A random root password has been set. You will find it in '/root/.mysql_secret'.2018-11-18 13:53:26 6420 [Note] Binlog end2018-11-18 13:53:26 6420 [Note] InnoDB: FTS optimize thread exiting.2018-11-18 13:53:26 6420 [Note] InnoDB: Starting shutdown...2018-11-18 13:53:27 6420 [Note] InnoDB: Shutdown completed; log sequence number 16259772018-11-18 13:53:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-11-18 13:53:27 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2018-11-18 13:53:27 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6444 ...2018-11-18 13:53:27 6444 [Note] InnoDB: Using atomics to ref count buffer pool pages2018-11-18 13:53:27 6444 [Note] InnoDB: The InnoDB memory heap is disabled2018-11-18 13:53:27 6444 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2018-11-18 13:53:27 6444 [Note] InnoDB: Memory barrier is not used2018-11-18 13:53:27 6444 [Note] InnoDB: Compressed tables use zlib 1.2.112018-11-18 13:53:27 6444 [Note] InnoDB: Using Linux native AIO2018-11-18 13:53:27 6444 [Note] InnoDB: Using CPU crc32 instructions2018-11-18 13:53:27 6444 [Note] InnoDB: Initializing buffer pool, size = 128.0M2018-11-18 13:53:27 6444 [Note] InnoDB: Completed initialization of buffer pool2018-11-18 13:53:27 6444 [Note] InnoDB: Highest supported file format is Barracuda.2018-11-18 13:53:27 6444 [Note] InnoDB: 128 rollback segment(s) are active.2018-11-18 13:53:27 6444 [Note] InnoDB: Waiting for purge to start2018-11-18 13:53:27 6444 [Note] InnoDB: 5.6.42 started; log sequence number 16259772018-11-18 13:53:27 6444 [Note] Binlog end2018-11-18 13:53:27 6444 [Note] InnoDB: FTS optimize thread exiting.2018-11-18 13:53:27 6444 [Note] InnoDB: Starting shutdown...2018-11-18 13:53:29 6444 [Note] InnoDB: Shutdown completed; log sequence number 1625987A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !You will find that password in '/root/.mysql_secret'.You must change that password on your first connect,no other statement but 'SET PASSWORD' will be accepted.See the manual for the semantics of the 'password expired' flag.Also, the account for the anonymous user has been removed.In addition, you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the test database.This is strongly recommended for production servers.See the manual for more instructions.Please report any problems at /The latest information about MySQL is available on the web atSupport MySQL by buying support/licenses at WARNING: Found existing config file /usr/f 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 /usr/f,please compare it with your file and take the changes you need.其中有两句指明mysql安装时给root设置了⼀个随机的初始密码:密码的位置放在'/root/.mysql_secret'⽂件中⽤于第⼀次登陆mysql时使⽤的,登陆之后会强制修改⼀下A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find that password in '/root/.mysql_secret'.You must change that password on your first connect,no other statement but 'SET PASSWORD' will be accepted.See the manual for the semantics of the 'password expired' flag.查看该⽂件,可以看到我在重装mysql时新⽣成⼀个随机密码ps –ef|grep –i mysql 看是否有mysql进程⽤rpm –qa |grep –I mysql看下mysql是否安装成功了,看到两个mysql的组件,就是安装成功了5.6以后要设置⼀个root账号的随机密码密码保存到root/.mysql_secret⽂件⾥后边需要⽤这个初始的密码登录mysql启动服务:service mysql startps –ef |grep mysql 看有没有mysql服务登录数据库:mysql –uroot –p 敲回车然后输⼊随机密码登录后,提⽰⼀些信息如连接线程id、版本什么的show databases; 查看数据库有哪些库在使⽤前要设置⼀个⾃⼰的密码会要求重置随机密码重置密码⽅法:set password=password(‘root’);是给当前⽤户设置密码为root再运⾏ show databases;mysql会⾃带⼀些系统库:information_schema存⼀些统计数据performance_schema存⼀些状态数据,mysql存的数据⽤于监控、权限、账号等test是测试库,⽤于做测试⽤的如果重新安装,数据⽬录没变的话,那么之前的库还是存在的。
linux中mysql基本操作
linux中mysql基本操作MySQL是一种流行的开源数据库管理系统,广泛用于Web应用程序的开发和管理。
在Linux中,可以使用终端或图形用户界面操作MySQL数据库。
以下是在Linux中进行MySQL基本操作的步骤:1.安装MySQL在Linux中安装MySQL,可以使用以下命令:sudo apt-get updatesudo apt-get install mysql-server2.启动MySQL安装完成后,可以使用以下命令启动MySQL:sudo service mysql start3.登录MySQL启动MySQL后,可以使用以下命令登录MySQL:mysql -u root -p其中,-u选项用于指定要使用的用户名,-p选项用于提示输入密码。
4.创建数据库在MySQL中,可以使用以下命令创建数据库:CREATE DATABASE database_name;其中,database_name是要创建的数据库的名称。
5.选择数据库在MySQL中,可以使用以下命令选择要使用的数据库:USE database_name;其中,database_name是要使用的数据库的名称。
6.创建表格在MySQL中,可以使用以下命令创建表格:CREATE TABLE table_name (column1 datatype,column2 datatype,column3 datatype,...);其中,table_name是要创建的表格的名称,column1、column2、column3等是表格的列,datatype是列的数据类型。
7.插入数据在MySQL中,可以使用以下命令将数据插入到表格中:INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);其中,table_name是要插入数据的表格的名称,column1、column2、column3等是表格的列,value1、value2、value3等是要插入的数据的值。
MySQL5.6(Win764位)下载、安装与配置图文教程
MySQL5.6(Win764位)下载、安装与配置图⽂教程MySQL是⽬前⼗分流⾏的⼀种关系型数据库管理系统。
官⽹推出的安装包有两种格式,分别是:ZIP格式和MSI格式。
其中MSI格式的可以直接点击安装,按照它给出的安装提⽰进⾏安装,⼀般MySQL将会安装在C:\Program Files\MySQL\MySQL Server x.x (x.x是版本号)该⽬录中;ZIP格式是⾃⼰解压,解压缩之后MySQL就可以使⽤了,但是要进⾏配置。
我⽤的是ZIP格式的,所以,在此主要叙述ZIP格式的MySQL下载、安装与配置。
⼀.⼯具Win7 64位操作系统⼆.步骤第⼀步:下载安装包定位到MySQL Community Edition关于MySQL的版本,从软件的使⽤授权⾓度来说,分为Community版本和Commercial版本,其中Community版本就是我们通常可以从MySQL官⽅⽹站上可以下载到的社区版,它是基于GPL协议的,只要你的应⽤系统遵循GPL协议⽽开源,或者你的应⽤是内部使⽤,没有通过分销应⽤软件⽽获利的话,或者你开发商业应⽤软件的研发阶段都可以完全免费的使⽤这个Community版本;⽽使⽤MySQL开发商业应⽤时,是⼀定要采⽤Commercial版本才能销售和实现盈利的,即使是你的客户下载安装的MySQL,从遵循软件使⽤授权协议的⾓度来说,也是要购买Commercial版本授权的。
因为最新的版本是5.7,通过右侧选择5.6或者5.5版本截⽌到⽬前(2016/7/24),官⽹的最新版本是5.7.13,不过⾃⼰没有使⽤该版本,下载的是之前的版本5.6.31。
平台默认为Windows。
确认⾃⼰的机器字长,点击download即可。
第⼆步:解压解压之后可以将该⽂件夹改名,放到合适的位置。
我是将⽂件夹改名为MySQL Server 5.6,放到D:\Program Files\MySQL路径中。
Linux CentOS6.5下编译安装MySQL 5.6.16
一、编译安装MySQL前的准备工作安装编译源码所需的工具和库[sql]view plaincopy1.yum install gcc gcc-c++ ncurses-devel perl安装cmake,从下载源码并编译安装[sql]view plaincopy1.wget /files/v2.8/cmake-2.8.10.2.tar.gz2.tar -xzvf cmake-2.8.10.2.tar.gz3.cd cmake-2.8.10.24../bootstrap ; make ; make install5.cd ~二、设置MySQL用户和组新增mysql用户组[sql]view plaincopy1.groupadd mysql新增mysql用户[sql]view plaincopyeradd -r -g mysql mysql三、新建MySQL所需要的目录新建mysql安装目录[sql]view plaincopy1.mkdir -p /usr/local/mysql新建mysql数据库数据文件目录[sql]view plaincopy1.mkdir -p /data/mysqldb四、下载MySQL源码包并解压从/downloads/mysql/直接下载源码,解压mysql-5.6.16.tar.gz(/这个网站就是用的5.6.16版本)[sql]view plaincopy1.wget /files/mysql-5.6.16.tar.gz2.tar -zxv -f mysql-5.6.16.tar.gz3.cd mysql-5.6.16设置编译参数[sql]view plaincopy1.cmake \2.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \3.-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \4.-DDEFAULT_CHARSET=utf8 \5.-DDEFAULT_COLLATION=utf8_general_ci \6.-DWITH_INNOBASE_STORAGE_ENGINE=1 \7.-DWITH_ARCHIVE_STORAGE_ENGINE=1 \8.-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \9.-DMYSQL_DATADIR=/data/mysqldb \10.-DMYSQL_TCP_PORT=3306 \11.-DENABLE_DOWNLOADS=1注:重新运行配置,需要删除CMakeCache.txt文件[sql]view plaincopy1.rm CMakeCache.txt编译源码[sql]view plaincopy1.make安装[sql]view plaincopy1.make install六、修改mysql目录所有者和组修改mysql安装目录[sql]view plaincopy1.cd /usr/local/mysql2.chown -R mysql:mysql .修改mysql数据库文件目录[sql]view plaincopy1.cd /data/mysqldb2.chown -R mysql:mysql .七、初始化mysql数据库[sql]view plaincopy1.cd /usr/local/mysql2.scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb八、复制mysql服务启动配置文件[sql]view plaincopy1.cp /usr/local/mysql/support-files/f /etc/f注:如果/etc/f文件存在,则覆盖。
mysql安装glibc版本
[root@tzcdh91 ~]# chmod +x /etc/init.d/mysql
[root@tzcdh91 ~]# chown -R mysql:mysql /etc/f
六、环境变量
PATH=$PATH:$HOME/bin:/mydata/mysql-5.6.22/bin
七、安装系统表
四、授权
chown -R mysql:mysql /mydata/
五、部署安装
[root@tzcdh91 ~]# cp /mydata/mysql-5.6.26/support-files/mysql.server /etc/init.d/mysql
[root@tzcdh91 ~]# chown -R mysql:mysql /etc/init.d/mysql
九、设置root密*/mydata/
三、创建mysql用户和组
[root@tzcdh91 ~]# groupadd mysql
[root@tzcdh91 ~]# useradd -g mysql -d /home/mysql mysql
[root@tzcdh91 ~]# passwd mysql
MySQL 5 rpm版本 for linux安装
一、从官网下载MySQL Community Server/downloads/选择相应的系统,通常linux选择Linux-Generic下载即可二、创建用户首先创建mysql用户,组mysql,根目录/home/mysql或者命令groupaddmysqluseradd -g mysql -d /home/mysqlmysql三、将安装包ftp传至/home/mysql/install 下解压(最好建一个install目录,因为会解压出来很多包)四、安装1、先查看原主机上又没有mysql(root用户操作)最后加了个--nodeps参数解决,2、安装server和client3、安装完启动./mysql.server脚本是调用/usr/bin/mysqld_safe来启动mysql的4、查看mysql是否启动,看进程+3306端口5、设定root用户密码这是第一次设定,如果修改就是mysqladmin -u root -p 旧密码password新密码6、尝试连接7、修改可以远程登录mysql>use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> select host,user, Password ,Select_priv from user;mysql> grant all on *.* to root@'%' identified by '6543210';Query OK, 0 rows affected (0.00 sec)mysql>GRANT USAGE ON *.* TO 'root'@'%' WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)mysql> select host,user from user where user='root';mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)修改用户密码mysql>use mysql;mysql>update user set password=password('新密码') WHERE User='root' and host='%'; mysql>flush privileges;√8、修改字符集查看原字符集:mysql>use mysqlReading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changedmysql> show variables like 'character_set%' ;mysql> show variables like 'collation_%';需要将/usr/share/mysql/fffff9、修改SQL不区分大小写在/etc/f中的[mysqld]后添加lower_case_table_names=1,重启MYSQL 服务10、支持procedure或者function编译及执行在mysql中编译或者执行procedure或者function时,可能会报如下错误This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)两种方法(1)在/etc/f中的[mysqld]后添加添加log_bin_trust_function_creators = 1,重启MYSQL服务(2)在控制台执行SQL> set global log_bin_trust_function_creators = 1;不过重启后会失效五、启动停止六、基本使用mysql> show databases; //查看数据库mysql> use test//选择数据库Database changedmysql> show tables;//查看表Empty set (0.00 sec)mysql> create table gl(id int(3) auto_increment not null primary key, name char(10) not null);//创建表Query OK, 0 rows affected (0.01 sec)mysql> select * from gl;Empty set (0.00 sec)mysql> show tables;//再次查看表mysql> insert into gl values("",'Guolei');//插入数据Query OK, 1 row affected, 1 warning (0.00 sec)mysql> select * from gl;//查询数据mysql> exitBye七、备份数据库使用mysqldump命令备份备份出来的test.bbb是个文本文件,可以使用more或者cat打开使用mysqldump命令导入备份备份注意:mysqldump: Got error: 1066: Not unique table/alias: 'pmamap' when using LOCK TABLES 需要加上--lock-tables=false参数。
原:安装版mysql 5.6安装问题
安装版mysql 5.6.17版本安装配置问题:201405041,先从360的软件管家里下载mysql 5.6.17,一键下载安装完成2,安装完成后点击:开始——所有程序——MySQL——MySQL Server5.6下面的两个MySQL5.6 Command Line Client和MySQL5.6 Command Line Client-Unicode,都是黑框一闪而过,看不清楚,多次点击无效。
3,为了修正一概而过的问题,点击:开始——所有程序——MySQL——MySQL Server5.6——MySQL5.6 Command Line Client,在MySQL5.6 Command Line Client上面点击鼠标右键,选择属性。
4,跳出属性框:将属性框中的目标(T)中的内容拷贝在记事本中:"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" "--defaults-file=C:\Program Files\MySQL\MySQL Server 5.6\my.ini" "-uroot" "-p",发现上面拷贝下来的内容中,要求MYSQL安装文件下有my.ini文件,但是发现实际文件夹下没有这个文件,于是将原有的my-default.ini文件复制,并修改名称为my.ini。
5,然后点击:开始——所有程序——MySQL——MySQL Server5.6下面的MySQL5.6 Command Line Client,出现黑框,要求输入密码,因为安装时没有设置密码,所以直接敲回车,却再次出现黑框一闪而过消失的情况:6,为了解决这个问题,进入DOS系统:开始——运行——输入cmd,第一次的界面如下面第一个图所示:图一7,然后输入命令如第二个图所示:进入MYSQL的安装文件夹下的bin目录:图二8,然后再次登录mysql仍然失败,如下面第三个图所示:图三9,打开计算机的服务:控制面板——管理工具——服务,查看发现没有MYSQL的服务,如下面第四个图所示:图四10,此时需要先安装mysql的服务,在dos中输入命令mysqld –install,如下面第五个图所示,发现服务中已经有了MYSQL的服务:图五11,但是该服务是处于停止状态还没有启动,此时打开mysql的cilent客户端,黑框还是一闪而过,需要启动MYSQL服务,启动方式有两种,一种是在dos中输入命令:net start mysql,一种是直接在服务中点击启动,结果却启动失败,如下面第六个图所示:图六12,寻找失败原因发现,是因为没有配置my.ini文件的原因,虽然ini文件已经存在了,但还是需要配置的,尤其是basedir文件和datadir文件,这是两个文件和日志的路径,一定要设置:图七13,此时再重新启动mysql的服务就可以成功了,如下面第八个图所示。
centos下MySQLLinux Generic 安装步骤
6、启动mysql5.6.26服务
?
1
/usr/local/mysql/bin/mysqld_safe--defaults-file=./f--user=mysql&
如果没有报错,且日志文件/usr/local/mysql/mysqld.log里没有错误信息,基本就已经启动好了,可以通过ps查看进程
2、下载之后,解压安装包
?
1
tar-zxvfmysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
然后通过cp指令复制解压出来的文件夹草/usr/local/mysql/(一定要将安装文件复制到mysql的安装目录下)
?
1
cp-frmysql-5.6.26-linux-glibc2.5-x86_64/*mysql
18
19
20
21
22
23
24
25
cat/etc/f
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
3、创建用户(如果已创建,忽略此步骤)
?
1
2
groupaddmysql
useradd-gmysqlmysql
4、安装mysql5.6.26
?
1
/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/data/mysql--user=mysql
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Mysql安装过程(linux:2.6.18-194.el5,Mysql:)1、安装[root@RAC2 mysql]# rpm -ivh MySQL-server-5.6.12-2.rhel5.x86_64.rpm Preparing...########################################### [100%]1:MySQL-server########################################### [100%][root@RAC2 mysql]# rpm -ivh MySQL-client-5.6.12-2.rhel5.x86_64.rpm Preparing...########################################### [100%]1:MySQL-client########################################### [100%]2、安装完查看默认3306端口没有开[root@RAC2 mysql]# netstat -natActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 0.0.0.0:833 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:111 0.0.0.0:* LISTENtcp 0 0 127.0.0.1:631 0.0.0.0:* LISTENtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTENtcp 0 0 :::22 :::* LISTENtcp 00 ::ffff:192.168.72.5:22 ::ffff:192.168.72.1:63851 ESTABLISHEDtcp 00 ::ffff:192.168.72.5:22 ::ffff:192.168.72.1:62929 ESTABLISHED3、将mysql启动[root@RAC2 init.d]# service mysql startStarting MySQL..[确定]4、再次确认端口是打开的[root@RAC2 init.d]# netstat -natActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 0.0.0.0:833 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:111 0.0.0.0:*LISTENtcp 0 0 127.0.0.1:631 0.0.0.0:* LISTENtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTENtcp 0 0 :::3306 :::* LISTENtcp 0 0 :::22 :::* LISTENtcp 00 ::ffff:192.168.72.5:22 ::ffff:192.168.72.1:63851 ESTABLISHEDtcp 00 ::ffff:192.168.72.5:22 ::ffff:192.168.72.1:62929 ESTABLISHED5、连接mysql[root@RAC2 bin]# mysql -u rootERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)在网上查资料,可以这样来解决:[root@RAC2 bin]# /etc/init.d/mysql stopShutting down MySQL..[确定][root@RAC2 bin]# mysqld_safe --user=mysql --skip-grant-tables--skip-networking &[1] 6025[root@RAC2 bin]# 130716 19:00:36 mysqld_safe Logging to'/var/lib/mysql/RAC2.err'.130716 19:00:36 mysqld_safe Starting mysqld daemon with databases from/var/lib/mysql[root@RAC2 bin]# 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.6.12 MySQL Community Server (GPL)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 respectiveowners.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.00 sec)mysql> use mysql;Database changedmysql> show tables;+---------------------------+| Tables_in_mysql |+---------------------------+| columns_priv || db || event || func || general_log || help_category || help_keyword || help_relation || help_topic || innodb_index_stats || innodb_table_stats || ndb_binlog_index || plugin || proc || procs_priv || proxies_priv || servers || slave_master_info || slave_relay_log_info || slave_worker_info || slow_log || tables_priv || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition || time_zone_transition_type || user |+---------------------------+28 rows in set (0.00 sec)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 || 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 || password_expired | enum('N','Y') | NO | | N | |+------------------------+-----------------------------------+------+-----+---------+-------+43 rows in set (0.00 sec)mysql> select hosr,user,password from user;ERROR 1054 (42S22): Unknown column 'hosr' in 'field list'mysql> select host,user,password from user;+-----------+------+-------------------------------------------+| host | user | password |+-----------+------+-------------------------------------------+| localhost | root | *34F5F8A5C7F9EA100FB15F7FCF1BC31271C3D43C || RAC2 | root | *34F5F8A5C7F9EA100FB15F7FCF1BC31271C3D43C || 127.0.0.1 | root | *34F5F8A5C7F9EA100FB15F7FCF1BC31271C3D43C || ::1 | root | *34F5F8A5C7F9EA100FB15F7FCF1BC31271C3D43C |+-----------+------+-------------------------------------------+4 rows in set (0.00 sec)mysql> update user set password=password('root123') where user='root'and host='localhost';Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> commit-> ;Query OK, 0 rows affected (0.00 sec)执行下面这一句,是因为上面使表处于:The MySQL server is running with the--skip-grant-tables option,如果不执行下面这句,即使连上数据库也执行不了操作。