Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DB="database_name"
- USER="mysql_user"
- PASS="mysql_password"
- (
- echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
- mysql -p$PASS -u $USER "$DB" -e "SHOW TABLES" --batch --skip-column-names \
- | xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
- ) \
- | mysql -p$PASS -u $USER "$DB"
- To get the script you work open your command line and use the following steps:
- 1. nano utf.sh
- 2. paste the script & save
- 3. sudo chmod 755 utf.sh (in terminal)
- 5. run the script by type ./utf.sh
- Yes, collation has been changed!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement