Mysql二进制安装
admin
2023-05-16 10:22:30
0

Mysql安装

安装步骤

1、新建用户

groupadd mysql

useradd -r -g mysql mysql

cd /usr/local/----------------------------注意路径

chown -R mysql:mysql  mysql

chmod -R 775  mysql

2、安装依赖包

yum install libai* -y

yum install ncurses-devel -y                                                                                                 

yum -y install bison                                                                                                                

yum install zlib zlib-devel -y                                                                                              

yum install zlib -y

yum instlal libxml libjpeg freetype libpnggd  curl libiconv  zlib-devel

yum install libxml2-devel libjpeg-develfreetype-devel libpng-devel gd-devel curl-devel -y

yum install gcc  -y                     

3、解压并将包放置在/usr/local下以mysql                                

tar -xvf mysql-5.5.28-linux2.6-i686.tar.gz

mv mysql-5.5.28-linux2.6-i686 /usr/local/mysql

5、初始化实例

cd  /usr/local/mysql/scripts

mkdir  /data

chown mysql:mysql  /data

chmod 775 mysql:mysql data

./mysql_install_db  --user=mysql  --basedir=/usr/local/mysql/   --datadir=/data/

basedir------------mysql软件安装路径

datadir------------------数据文件存放路径

WARNING: The host 'mysql01' could not belooked up with resolveip.

This probably means that your libclibraries are not 100 % compatible

with this binary MySQL version. The MySQLdaemon, mysqld, should work

normally with the exception that host nameresolving will not work.

This means that you should use IP addressesinstead of hostnames

when specifying MySQL privileges !

Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boot time you have tocopy

support-files/mysql.server to the rightplace for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !

To do so, start the server, then issue thefollowing commands:

/usr/local/mysql//bin/mysqladmin -u rootpassword 'new-password'

/usr/local/mysql//bin/mysqladmin -u root -hmysql01 password 'new-password'

Alternatively you can run:

/usr/local/mysql//bin/mysql_secure_installation

which will also give you the option ofremoving the test

databases and anonymous user created bydefault.  This is

strongly recommended for productionservers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr/local/mysql/ ;/usr/local/mysql//bin/mysqld_safe &

You can test the MySQL daemon withmysql-test-run.pl

cd /usr/local/mysql//mysql-test ; perlmysql-test-run.pl

Please report any problems with the/usr/local/mysql//scripts/mysqlbug script!

6、初始化配置文件修改

cp  /usr/local/mysql/support-files/my-small.cnf  /etc/my.cnf

 

[client]

port            = 3306

socket          = /data/mysql.sock

 

[mysql]

no-auto-rehash

 

[mysqld]

user   = mysql

port   = 3306

socket = /data/mysql.sock

basedir = /usr/local/mysql

datadir = /data

open_files_limit    = 1024

back_log = 600

max_connections = 800

max_connect_errors = 3000

table_cache = 614

external-locking = FALSE

max_allowed_packet =8M

sort_buffer_size = 1M

join_buffer_size = 1M

thread_cache_size = 100

thread_concurrency = 2

query_cache_size = 2M

query_cache_limit = 1M

query_cache_min_res_unit = 2k

#default_table_type = InnoDB

thread_stack = 192K

#transaction_isolation = READ-COMMITTED

tmp_table_size = 2M

max_heap_table_size = 2M

long_query_time = 1

#log_long_format

#log-error = /data/error.log

#log-slow-queries = /data/slow.log

pid-file = /data/mysql.pid

log-bin = /data/mysql-bin

relay-log = /data/relay-bin

binlog_cache_size = 1M

max_binlog_cache_size = 1M

max_binlog_size = 2M

expire_logs_days = 7

key_buffer_size = 16M

read_buffer_size = 1M

read_rnd_buffer_size = 1M

bulk_insert_buffer_size = 1M

#myisam_sort_buffer_size = 1M

#myisam_max_sort_file_size = 10G

#myisam_max_extra_sort_file_size = 10G

#myisam_repair_threads = 1

#myisam_recover

lower_case_table_names = 1

skip-name-resolve

slave-skip-errors = 1032,1062

replicate-ignore-db=mysql

server-id = 1

innodb_additional_mem_pool_size = 4M

innodb_buffer_pool_size = 32M

innodb_data_file_path =ibdata1:128M:autoextend

innodb_file_io_threads = 4

innodb_thread_concurrency = 8

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 2M

innodb_log_file_size = 4M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 120

innodb_file_per_table = 0

[mysqldump]

quick

max_allowed_packet = 2M

[mysqld_safe]

log-error=/data/mysql_oldboy3306.err

pid-file=/data/mysqld.pid

Mysql启动

1、配置环境变量

 PATH=$PATH:$HOME/bin:/usr/local/mysql/bin

2、启停数据库

mysqld_safe   --defaults-file=/etc/my.cnf  --user=mysql &

--defaults-file 表示配置文件路径

--user指定用那个用户启动

Mysql基本管理与维护

登录mysql

本地服务器多实例登录mysql

mysql  -u  -p      --socket=/data/mysql.sock


相关内容

热门资讯

以“第一”之名赴强军之约(强军... 运—20A飞机在飞行中释放干扰弹。刘 川摄火箭军某部官兵正在集结登车。刘志词摄武警安徽总队合肥支队官...
金融时报:特朗普改口,伊朗已在... 当地时间8月2日,英国《金融时报》发文《伊朗在对特朗普政府的战争中占据主动权》。文章分析,经过半年的...
男孩在街边配电箱边玩耍时触电昏... 8月1日,河南三门峡灵宝市,有网友发视频称,一个男孩在桃林街上的一个配电箱旁触电晕倒,视频显示,急救...
遥控板按开关电视机啪的一声电视... 遥控板按开关电视机啪的一声电视没有电源了正常情况下遥控板按开关不会引起电视没有电源的问题,出现此类问...
按下启动键脱水嗡嗡响 1、脱水时转速高。2、衣物放置不平整。3、洗衣机放置的位置有问题。4、洗衣机内有异物存在。5、排水阀...
热水器复位键按下弹起 热水器复位键按下弹起:可能是热水器遥控器无法使用,或是遥控器电量耗尽,可以更换电池再使用;热水器频繁...
热水器开关是一直开着还是不用就... 不用就关,要是常年一直二十四小时开着,极易造成超负荷运行,热水器本身的使用时间就不久,要是二十四小时...
冰柜有个加热灯是开还是关 不需要关注具体的开关状态,因为冰箱在实际工作的过程当中,内部都会安装相应的自动感温装置,根据用户的设...
日本最新民调公布:76%民众支... 日本《琉球新报》2日报道,日本舆论调查协会8月1日公布的一项最新民意调查结果显示,76%的日本民众认...
疯狂降智的谷歌,彻底沦为“美国... 如果要问,现在谁家的AI能力最强?ChatGPT、Claude、DeepSeek各有千秋,吵上三天三...