percona server的安装启动配置

1,调整最大文件数限制
ulimit -n
1024          #这个是默认值

echo ulimit -n 65535 >>/etc/profile 

source /etc/profile    #加载修改后的profile 

ulimit -n     #显示65535,修改完毕! 

2,修改IO调度器设置

[root@mysql support-files]# cat /sys/block/sda/queue/scheduler 
noop anticipatory [deadline] cfq                                #采用deadline的io调度器,重启后失效

title CentOS (2.6.32-220.el6.x86_64)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=5b4002c7-52b5-4749-8d87-ac61bacd0c8d rd_NO_LUKS rd_NO_LVM LANG=en_US
.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 elevator=deadline numa=off rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_
DM
        initrd /boot/initramfs-2.6.32-220.el6.x86_64.img             #修改IO调度器和关闭numa,修改内核启动参数

3,修改swappiness设置
vi /etc/sysctl.conf

vm.swappiness = 0

sysctl -p

4,磁盘分区及文件类型
/  根分区采用ext4
/opt 采用xfs

查看磁盘分区的文件类型

[root@mysql ~]# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  24.3GB  24.3GB  primary  ext4            boot
 2      24.3GB  45.3GB  21.0GB  primary  xfs
 3      45.3GB  53.7GB  8389MB  primary  linux-swap(v1)

(parted)                


6,手工安装gcc

rpm -ivh gcc-4.4.6-3.el6.x86_64.rpm cloog-ppl-0.15.7-1.2.el6.x86_64.rpm cpp-4.4.6-3.el6.x86_64.rpm glibc-devel-2.12-1.47.el6.x86_64.rpm \
libgomp-4.4.6-3.el6.x86_64.rpm mpfr-2.4.1-6.el6.x86_64.rpm ppl-0.10.2-11.el6.x86_64.rpm glibc-headers-2.12-1.47.el6.x86_64.rpm kernel-headers-2.6.32-220.el6.x86_64.rpm

手工安装gcc-c++

rpm -ivh gcc-c++-4.4.6-3.el6.x86_64.rpm libstdc++-devel-4.4.6-3.el6.x86_64.rpm


tar xzvf cmakeXXXXX
tar zxvf percornaxxxxx

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
安装cmake

cd ~/cmake

./bootstrap   
#检查无误后安装  
make && make install  
检查是否安装成功:
输入shell命令: cmake --version
给出一下信息表示安装成功:cmake version 2.8.10.2

cmake 会默认安装在 /usr/local/bin 下面
要改变安装路径,在bootstrap命令中加入'--prefix=PATH'选项。


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

安装percorna server


#建立安装目录和数据存放目录
mkdir -p /opt/mysql  
mkdir -p /opt/mysql/data  
cd /opt/mysql  
mkdir run data tmp logs  
chown -R mysql:mysql /opt/mysql

安装

tar zxvf Percona-Server-5.6.15-rel63.0.tar.gz  
cd Percona-Server-5.6.15  
cmake . -LH  
cmake .  \  
-DCMAKE_INSTALL_PREFIX=/opt/mysql \ #设置程序安装路径  
-DMYSQL_DATADIR=/opt/mysql/data \ #设置数据存放路径  
-DSYSCONFDIR=/etc \   
-DWITH_MYISAM_STORAGE_ENGINE=1 \ #启用MYISAM存储引擎  
-DWITH_INNOBASE_STORAGE_ENGINE=1 \  
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \  
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \  
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \  
-DWITH_FEDERATED_STORAGE_ENGINE=1  \  
-DWITH_READLINE=1 \ #启用MySQL快捷键  
-DMYSQL_UNIX_ADDR=/opt/mysql/run/mysqld.sock \ #设置套接字存放位置  
-DMYSQL_TCP_PORT=3306  \ #设置开放端口  
-DENABLED_LOCAL_INFILE=1  \ #设置读取本地文件  
-DWITH_PARTITION_STORAGE_ENGINE=1 \  
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 \ #默认字符串  
-DDEFAULT_COLLATION=utf8_general_ci #默认检验规则  

cmake .  -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_DATADIR=/opt/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/opt/mysql/run/mysqld.sock \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

make  && make install  


初始化数据库:

/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql


4种启动方式:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

第一种:mysql.server

service mysqld start/stop/restart

/root/percona-server-5.6.20-68.0/support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

vi /etc/init.d/mysqld

修改以下参数
basedir=/opt/mysql
datadir=/opt/mysql/data

[root@mysql support-files]# service mysqld start
Starting MySQL (Percona Server). SUCCESS! 
[root@mysql support-files]# service mysqld stop
Shutting down MySQL (Percona Server).. SUCCESS! 
[root@mysql support-files]# service mysqld restart
 ERROR! MySQL (Percona Server) PID file could not be found!
Starting MySQL (Percona Server). SUCCESS! 
[root@mysql support-files]# 


注意查看error log中的mysql启动日志
140913 15:16:07 mysqld_safe mysqld from pid file /opt/mysql/data/mysql.pid ended
140913 15:16:12 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data
2014-09-13 15:16:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-09-13 15:16:12 22831 [Note] Plugin 'FEDERATED' is disabled.
2014-09-13 15:16:12 22831 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-09-13 15:16:12 22831 [Note] InnoDB: The InnoDB memory heap is disabled
2014-09-13 15:16:12 22831 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-09-13 15:16:12 22831 [Note] InnoDB: Memory barrier is not used
2014-09-13 15:16:12 22831 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-09-13 15:16:12 22831 [Note] InnoDB: Not using CPU crc32 instructions
2014-09-13 15:16:12 22831 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-09-13 15:16:12 22831 [Note] InnoDB: Completed initialization of buffer pool
2014-09-13 15:16:12 22831 [Note] InnoDB: Highest supported file format is Barracuda.
2014-09-13 15:16:12 22831 [Note] InnoDB: 128 rollback segment(s) are active.
2014-09-13 15:16:12 22831 [Note] InnoDB: Waiting for purge to start
2014-09-13 15:16:12 22831 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626047
2014-09-13 15:16:12 22831 [Note] Server hostname (bind-address): '*'; port: 3306
2014-09-13 15:16:12 22831 [Note] IPv6 is available.
2014-09-13 15:16:12 22831 [Note]   - '::' resolves to '::';
2014-09-13 15:16:12 22831 [Note] Server socket created on IP: '::'.
2014-09-13 15:16:12 22831 [Note] Event Scheduler: Loaded 0 events
2014-09-13 15:16:12 22831 [Note] /opt/mysql/bin/mysqld: ready for connections.
Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution


mysql的关闭日志

2014-09-13 15:17:16 22831 [Note] /opt/mysql/bin/mysqld: Normal shutdown

2014-09-13 15:17:16 22831 [Note] Giving 0 client threads a chance to die gracefully
2014-09-13 15:17:16 22831 [Note] Event Scheduler: Purging the queue. 0 events
2014-09-13 15:17:16 22831 [Note] Shutting down slave threads
2014-09-13 15:17:16 22831 [Note] Forcefully disconnecting 0 remaining clients
2014-09-13 15:17:16 22831 [Note] Binlog end
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'partition'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'BLACKHOLE'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CHANGED_PAGES'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_METRICS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMPMEM'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_LOCKS'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_TRX'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'XTRADB_RSEG'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'XTRADB_INTERNAL_HASH_TABLES'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'XTRADB_READ_VIEW'
2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'InnoDB'
2014-09-13 15:17:16 22831 [Note] InnoDB: FTS optimize thread exiting.
2014-09-13 15:17:16 22831 [Note] InnoDB: Starting shutdown...
2014-09-13 15:17:17 22831 [Note] InnoDB: Shutdown completed; log sequence number 1626057
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'ARCHIVE'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'MEMORY'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'MyISAM'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'CSV'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'MRG_MYISAM'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'sha256_password'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'mysql_old_password'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'mysql_native_password'
2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'binlog'
2014-09-13 15:17:17 22831 [Note] /opt/mysql/bin/mysqld: Shutdown complete

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

第二种:mysqld_safe

在安装目录的bin下面
以下提示说明服务已经启动了
[root@mysql support-files]# /opt/mysql/bin/mysqld_safe &
[1] 22896
[root@mysql support-files]# 140913 15:19:32 mysqld_safe Logging to '/opt/mysql/data/mysql.err'.
140913 15:19:32 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data

[root@mysql support-files]# 


140913 15:16:07 mysqld_safe mysqld from pid file /opt/mysql/data/mysql.pid ended
140913 15:16:12 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data
2014-09-13 15:16:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-09-13 15:16:12 22831 [Note] Plugin 'FEDERATED' is disabled.
2014-09-13 15:16:12 22831 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-09-13 15:16:12 22831 [Note] InnoDB: The InnoDB memory heap is disabled
2014-09-13 15:16:12 22831 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-09-13 15:16:12 22831 [Note] InnoDB: Memory barrier is not used
2014-09-13 15:16:12 22831 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-09-13 15:16:12 22831 [Note] InnoDB: Not using CPU crc32 instructions
2014-09-13 15:16:12 22831 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-09-13 15:16:12 22831 [Note] InnoDB: Completed initialization of buffer pool
2014-09-13 15:16:12 22831 [Note] InnoDB: Highest supported file format is Barracuda.
2014-09-13 15:16:12 22831 [Note] InnoDB: 128 rollback segment(s) are active.
2014-09-13 15:16:12 22831 [Note] InnoDB: Waiting for purge to start
2014-09-13 15:16:12 22831 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626047
2014-09-13 15:16:12 22831 [Note] Server hostname (bind-address): '*'; port: 3306
2014-09-13 15:16:12 22831 [Note] IPv6 is available.
2014-09-13 15:16:12 22831 [Note]   - '::' resolves to '::';
2014-09-13 15:16:12 22831 [Note] Server socket created on IP: '::'.
2014-09-13 15:16:12 22831 [Note] Event Scheduler: Loaded 0 events
2014-09-13 15:16:12 22831 [Note] /opt/mysql/bin/mysqld: ready for connections.
Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution

mysqld_safe不能关闭数据库,使用以下命令可以关闭数据库

[root@mysql support-files]# service mysqld stop
Shutting down MySQL (Percona Server)..140913 15:21:03 mysqld_safe mysqld from pid file /opt/mysql/data/mysql.pid ended
 SUCCESS! 
[1]+  Done                    /opt/mysql/bin/mysqld_safe
[root@mysql support-files]# 



!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

第三种方式:mysqld

这个和mysqld_safe命令是在

[root@mysql bin]# mysqld --defaults-file=/etc/my.cnf --user=root                                                 
2014-09-13 15:24:32 23019 [Note] Plugin 'FEDERATED' is disabled.
2014-09-13 15:24:32 23019 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-09-13 15:24:32 23019 [Note] InnoDB: The InnoDB memory heap is disabled
2014-09-13 15:24:32 23019 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-09-13 15:24:32 23019 [Note] InnoDB: Memory barrier is not used
2014-09-13 15:24:32 23019 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-09-13 15:24:32 23019 [Note] InnoDB: Not using CPU crc32 instructions
2014-09-13 15:24:32 23019 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-09-13 15:24:32 23019 [Note] InnoDB: Completed initialization of buffer pool
2014-09-13 15:24:32 23019 [Note] InnoDB: Highest supported file format is Barracuda.
2014-09-13 15:24:32 23019 [Note] InnoDB: 128 rollback segment(s) are active.
2014-09-13 15:24:32 23019 [Note] InnoDB: Waiting for purge to start
2014-09-13 15:24:32 23019 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626067
2014-09-13 15:24:32 23019 [Note] Server hostname (bind-address): '*'; port: 3306
2014-09-13 15:24:32 23019 [Note] IPv6 is available.
2014-09-13 15:24:32 23019 [Note]   - '::' resolves to '::';
2014-09-13 15:24:32 23019 [Note] Server socket created on IP: '::'.
2014-09-13 15:24:32 23019 [Note] Event Scheduler: Loaded 0 events
2014-09-13 15:24:32 23019 [Note] mysqld: ready for connections.
Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution

mysql用户也是可以启动的

[root@mysql ~]# /opt/mysql/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql
2014-09-13 15:29:30 23108 [Note] Plugin 'FEDERATED' is disabled.
2014-09-13 15:29:30 23108 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-09-13 15:29:30 23108 [Note] InnoDB: The InnoDB memory heap is disabled
2014-09-13 15:29:30 23108 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-09-13 15:29:30 23108 [Note] InnoDB: Memory barrier is not used
2014-09-13 15:29:30 23108 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-09-13 15:29:30 23108 [Note] InnoDB: Not using CPU crc32 instructions
2014-09-13 15:29:30 23108 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-09-13 15:29:30 23108 [Note] InnoDB: Completed initialization of buffer pool
2014-09-13 15:29:30 23108 [Note] InnoDB: Highest supported file format is Barracuda.
2014-09-13 15:29:30 23108 [Note] InnoDB: 128 rollback segment(s) are active.
2014-09-13 15:29:30 23108 [Note] InnoDB: Waiting for purge to start
2014-09-13 15:29:30 23108 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626077
2014-09-13 15:29:30 23108 [Note] Server hostname (bind-address): '*'; port: 3306
2014-09-13 15:29:30 23108 [Note] IPv6 is available.
2014-09-13 15:29:30 23108 [Note]   - '::' resolves to '::';
2014-09-13 15:29:30 23108 [Note] Server socket created on IP: '::'.
2014-09-13 15:29:30 23108 [Note] Event Scheduler: Loaded 0 events
2014-09-13 15:29:30 23108 [Note] /opt/mysql/bin/mysqld: ready for connections.
Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

第四种:mysqld_multi

/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql
/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data3307 --user=mysql


数据库初始化的正确状态:
[root@mysql mysql]# /opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql
Installing MySQL system tables...OK

Filling help tables...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:

  /opt/mysql/bin/mysqladmin -u root password 'new-password'
  /opt/mysql/bin/mysqladmin -u root -h mysql password 'new-password'

Alternatively you can run:

  /opt/mysql/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 . ; /opt/mysql/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
 https://bugs.launchpad.net/percona-server/+filebug

The latest information about Percona Server is available on the web at
  http://www.percona.com/software/percona-server

Support Percona by buying support at
 http://www.percona.com/products/mysql-support

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

[mysqld3306]
port            = 3306
socket          = /tmp/mysql3306.sock
pid-file	= /tmp/mysql3306.pid
basedir		= /usr/local/mysql
datadir		= /usr/local/mysql/data

[mysqld3307]
port            = 3307
socket          = /tmp/mysql3307.sock
pid-file	= /tmp/mysql3307.pid
basedir		= /usr/local/mysql
datadir		= /usr/local/mysql/data3307

多实例开启
[root@mysql bin]# mysqld_multi start 3307
[root@mysql bin]# mysqld_multi start 3306
[root@mysql bin]# mysqld_multi report
Reporting MySQL (Percona Server) servers
MySQL (Percona Server) from group: mysqld3306 is running
MySQL (Percona Server) from group: mysqld3307 is running

多实例关闭
[root@mysql bin]# mysqld_multi stop 3306 
[root@mysql bin]# mysqld_multi stop 3307
[root@mysql bin]# mysqld_multi report
Reporting MySQL (Percona Server) servers
MySQL (Percona Server) from group: mysqld3306 is not running
MySQL (Percona Server) from group: mysqld3307 is not running
[root@mysql bin]# 


[root@mysql bin]# mysqld_multi start 3307
[root@mysql bin]# mysqld_multi start 3306
[root@mysql bin]# 
[root@mysql bin]# 
[root@mysql bin]# ps -ef|grep mysqld     
root     26230     1  0 15:48 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --port=3307 --socket=/tmp/mysql3307.sock --pid-file=/tmp/mysql3307.pid --skip-external-locking --key_buffer_size=16M --max_allowed_packet=1M --table_open_cache=64 --sort_buffer_size=512K --net_buffer_length=8K --read_buffer_size=256K --read_rnd_buffer_size=512K --myisam_sort_buffer_size=8M --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data3307
mysql    26506 26230  1 15:48 pts/2    00:00:00 /opt/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data3307 --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --skip-external-locking --key-buffer-size=16M --max-allowed-packet=1M --table-open-cache=64 --sort-buffer-size=512K --net-buffer-length=8K --read-buffer-size=256K --read-rnd-buffer-size=512K --myisam-sort-buffer-size=8M --log-error=/usr/local/mysql/data3307/mysql.err --pid-file=/tmp/mysql3307.pid --socket=/tmp/mysql3307.sock --port=3307
root     26535     1  0 15:48 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --port=3306 --socket=/tmp/mysql3306.sock --pid-file=/tmp/mysql3306.pid --skip-external-locking --key_buffer_size=16M --max_allowed_packet=1M --table_open_cache=64 --sort_buffer_size=512K --net_buffer_length=8K --read_buffer_size=256K --read_rnd_buffer_size=512K --myisam_sort_buffer_size=8M --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
mysql    26811 26535  3 15:48 pts/2    00:00:00 /opt/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --skip-external-locking --key-buffer-size=16M --max-allowed-packet=1M --table-open-cache=64 --sort-buffer-size=512K --net-buffer-length=8K --read-buffer-size=256K --read-rnd-buffer-size=512K --myisam-sort-buffer-size=8M --log-error=/usr/local/mysql/data/mysql.err --pid-file=/tmp/mysql3306.pid --socket=/tmp/mysql3306.sock --port=3306
root     26836 21316  0 15:48 pts/2    00:00:00 grep mysqld

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值