deepin 安装mysql

/wwwRoot/mysql/wwwRoot/mysql官网 https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

安装资料

shell> apt-cache search libaio # search for info
shell> apt-get install libaio1 # install library

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &

# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

 

错误1:

5.7.20# bin/mysqld --initialize --user=mysql
2017-12-17T01:20:52.448395Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-12-17T01:20:53.007185Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-12-17T01:20:53.057580Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-12-17T01:20:53.122093Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 8637a948-e2c8-11e7-9675-000c2987d513.
2017-12-17T01:20:53.124177Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-12-17T01:20:53.124904Z 1 [Note] A temporary password is generated for root@localhost: g9p+HawiV/s#
2017-12-17T01:20:53.127760Z 1 [ERROR] 1 Can't create/write to file '/media/shaoyang/6924c011-8204-42a3-9e3e-db9816f210ba/mysql-5.7.20/data/mysql/db.MYI' (Errcode: 13 - Permission denied)
2017-12-17T01:20:53.127945Z 0 [ERROR] Aborting

2017-12-17T01:20:53.230963Z 0 [ERROR] InnoDB: Cannot open '/media/shaoyang/6924c011-8204-42a3-9e3e-db9816f210ba/mysql-5.7.20/data/ib_buffer_pool.incomplete' for writing: Permission denied

是因为没有配置文件 (添加配置 文件即可)
mkdir /wwwRoot/mysql
chowm -R mysql:mysql /wwwRoot/mysql

[client]       
#客户端设置,即客户端默认的连接参数
#port = 3306                 
#默认连接端口
socket = /wwwRoot/mysql/mysql.sock   
#用于本地连接的socket套接字
[mysqld]
datadir=/wwwRoot/mysql
socket=/wwwRoot/mysql/mysql.sock
user=mysql
log-error =/wwwRoot/mysql/error.log
pid-file=/wwwRoot/mysql/mysqld.pid
#skip-grant-tables=true
# Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
[mysqld_safe]
log-error=/wwwRoot/mysql/mysqld.log
pid-file=/wwwRoot/mysql/mysqld.pid

mysql 默认给了给临时密码
cat /wwwRoot/mysql/error.log
[Note] A temporary password is generated for root@localhost: =cQ/tj)!)3y5

用 =cQ/tj)!)3y5 用这个临时密码登录修改密码
set password for root@localhost = password('123456');

如果找不到临时密码
就启动 不需要密码登录
[mysqld]
datadir=/wwwRoot/mysql
skip-grant-tables=true

启动后 mysql -h 127.0.0.1 直接登录
修改密码 set password for root@localhost = password('123456');

如果报错:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
执行 : flush privileges ;
在修改密码

support-files/mysql.server start 启动数据库

 

posted on 2017-12-17 12:09  少杨  阅读(1389)  评论(0编辑  收藏  举报