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 啟動數據庫

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM