linux-mysql安装记录

1. 创建用户和组,解压文件,建立link
groupadd mysql

useradd -r -g mysql mysql

tar -xvzf mysql-advanced-5.6.10-linux-glibc2.5-x86_64.tar.gz -C /usr/local/src/

cd /usr/local/src/
ln -s mysql-advanced-5.6.10-linux-glibc2.5-x86_64 mysql

cd mysql
chown -R mysql .
chgrp -R mysql .


2. 安装mysql

scripts/mysql_install_db  --user=mysql

--success alert

3.更改权限

chown -R root .
chown -R mysql data

/**********************以下是可选的操作***********************/

4.配置文件,开机自动启动

# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

/*********************************************/
5. 启动服务
support-files/mysql.server start

///etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
skip-name-resolve
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
 basedir = /usr/local/mysql
 datadir = /usr/local/mysql/data
 port = 3306
 server_id =1
 socket =/tmp/mysql3306.sock

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

//更改root用户密码
./bin/mysqladmin -u root password "*********" -S /tmp/mysql3306.sock
登录  ./bin/mysql -uroot -p -S /tmp/mysql3306.sock

-- 这个是不行的,有个字段没有默认值 insert into mysql.user(Host,User,Password) values('localhost','username',password('********'));
这个可以
grant all privileges on *.* to dba@'%' identified by '20062006';


//others

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 localhost 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 with the ./bin/mysqlbug script!

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

New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

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

你可能感兴趣的:(linux-mysql安装记录)