opensuse免安装mysql

opensuse系统免安装运行mysql

 1、下载mysql

http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

 

2、解压文件

tar xzvf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

 

3、创建软链

ln -s mysql-5.6.30-linux-glibc2.5-x86_64 mysql 

 

4、配置文件和参数:复制mysql/support-files/my-default.cnf到etc/my.cnf

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

 

5、修改my.cnf参数

[client]
default-character-set = utf8
# password      = your_passsword
port            = 3306
socket          = /tmp/mysql_3306.sock

# The MySQL server
[mysqld]
character-set-server = utf8
# user            = mysql
port            = 3306
socket          = /tmp/mysql_3306.sock
skip-external-locking
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
log-error = /usr/local/mysql/log/mysql_error.log
pid-file = /tmp/mysql.pid
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64

 

6、初始化数据库:在mysql/bin或者mysql/scripts下有个 mysql_install_db 可执行文件

./mysql_install_db  --verbose --user=root --defaults-file=/etc/my.cnf --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --tmpdir=/tmp

 

7、启动数据库:bin/

./mysqld_safe --defaults-file=/etc/my.cnf --socket=/tmp/mysql_3306.sock --user=root &

 

8、登录mysql

./mysql -uroot -p

 

9、关闭数据库

./mysqladmin -u root -p [密码] shutdown或者杀死进程

 

posted @ 2019-04-03 09:42  antlord  阅读(618)  评论(0编辑  收藏  举报