onsdag 12 juni 2019

MySQL on USB disk with Raspbian

#Install MySQL
sudo apt-get install -y mysql-server

#Stop daemon
sudo /etc/init.d/mysql stop

#Copy data
sudo cp -Rp /var/lib/mysql /usbdisc

#Manualy edit config file to change data dir
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf 

datadir = /usbdisc/mysql
#bind-address            = 127.0.0.1


#Start MySQL
sudo /etc/init.d/mysql start



#Create root user
sudo mysql -u root
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
exit



#*************************************************** 
#**********            Misc               **********
#***************************************************


#Config directory
/etc/mysql


#Uninstall
sudo apt-get remove --purge mysql-server mysql-client mysql-common -y

sudo apt-get autoremove -y

sudo apt-get autoclean

#Remove the MySQL folder:
rm -rf /etc/mysql

#Delete all MySQL files on your server. This is dangerous!!!
sudo find / -iname 'mysql*' -exec rm -rf {} \;


Inga kommentarer:

Skicka en kommentar