ubuntu16 04下的MySQL離線安裝

2021-09-11 13:06:56 字數 3306 閱讀 2887

apt-get install mysql-server

apt-get install mysql-client

apt-get install libmysqlclient-dev

複製**

mysql免安裝包:mirrors.sohu.com/mysql/mysql…

依賴包:archive.ubuntu.com/ubuntu/pool…

dpkg -i libaio1_0.3.110-2_amd64.deb

複製**

mkdir /mysql /mysql/data /mysql/log

複製**

tar zxf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

複製**

mv mysql-5.7.17-linux-glibc2.5-x86_64  /usr/local/mysql

複製**

groupadd mysql

useradd -g mysql mysql

複製**

chown -r mysql:mysql /usr/local/mysql /mysql

複製**

vi /etc/my.cnf

[client]

port = 3306

socket = /tmp/mysql.sock

[mysqld]

server_id=10

port = 3306

user = mysql

socket = /tmp/mysql.sock

basedir = /usr/local/mysql

datadir = /mysql/data

pid-file = /mysql/data/mysql.pid

max_connections = 1000

max_connect_errors = 1000

table_open_cache = 1024

max_allowed_packet = 128m

open_files_limit = 65535

#####***********************************=[innodb]******************************

innodb_buffer_pool_size = 1024m

innodb_file_per_table = 1

innodb_write_io_threads = 4

innodb_read_io_threads = 4

innodb_purge_threads = 2

innodb_flush_log_at_trx_commit = 1

innodb_log_file_size = 512m

innodb_log_files_in_group = 2

innodb_log_buffer_size = 16m

innodb_max_dirty_pages_pct = 80

innodb_lock_wait_timeout = 30

innodb_data_file_path=ibdata1:1024m:autoextend

#####***********************************=[log]******************************

log_error = /mysql/log/mysql-error.log

slow_query_log = 1

long_query_time = 1

slow_query_log_file = /mysql/log/mysql-slow.log

sql_mode=only_full_group_by,strict_trans_tables,no_zero_in_date,no_zero_date,error_for_division_by_zero,no_auto_create_user,no_engine_substitution

複製**

chmod +x /usr/local/mysql/bin/*

複製**

vim /etc/profile

export path=$path:/usr/local/mysql/bin

source /etc/profile

複製**

cp /usr/local/mysqlsupport-files/mysql.server /etc/init.d/mysql

複製**

update-rc.d mysql defaults

複製**

mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/home/fabric/mysql/data --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp

複製**

cd /usr/local/mysql/support-files

./mysql.server start

./mysql.server status(檢視狀態,如果顯示【 * mysql running】則說明啟動成功)

複製**

a temporary password is generated for root@localhost: *****************

複製**

mysql -u root -p

輸入14中檢視的預設密碼

mysql>set password = password('your new password');

mysql>update mysql.user set authentication_string=password('your new password') where user='root';

mysql>grant all privileges on *.* to 'root'@'%' identified by 'your new password';

mysql>flush privileges;

複製**

Ubuntu16 04下terminator的使用

安裝terminator sudo apt get install terminator常用快捷鍵 命令 說明 ctrl shift o 水平分割視窗 ctrl shift e 垂直分割視窗 f11 全屏 退出全屏 ctrl shift c 複製 ctrl shift v 貼上 ctrl tab 在...

Ubuntu16 04下解除安裝CUDA

sudo apt get install cuda你可能會猛然發現終端上顯示安裝的愕然都是cuda10.0 也就是最新版本 等到安裝結束,你再仔細一看,還確實是安裝了10.0。於是就開始抓頭自問 不對呀,我明明是照著文件安裝下來的呀,怎麼就變成10.0的了?原來是安裝cuda的時候,版本自動幫你替換...

Ubuntu16 04下解除安裝CUDA

你可能會猛然發現終端上顯示安裝的愕然都是cuda10.0 也就是最新版本 等到安裝結束,你再仔細一看,還確實是安裝了10.0。於是就開始抓頭自問 不對呀,我明明是照著文件安裝下來的呀,怎麼就變成10.0的了?原來是安裝cuda的時候,版本自動幫你替換成了最新版 該怎麼說呢?真是謝謝您了lol 解決辦...