Browse Source

Add db init scripts

pull/21/head
pb 4 days ago
parent
commit
3f705d1adb
3 changed files with 63 additions and 5 deletions
  1. 2
    5
      i.lin.sh
  2. 38
    0
      i.sqlexpress.centos.sh
  3. 23
    0
      mysql.init.sh

+ 2
- 5
i.lin.sh View File

@@ -267,14 +267,11 @@ cd ..
sudo ln -s $ROOT/elxr/bin/elxr $(npm bin -g)/elxr

elxr use $INSTANCENAME
elxr install
elxr i $INSTANCENAME

echo "Module configuration generated for: $INSTANCENAME"
echo "module.exports = { instanceName : '$INSTANCENAME', reposerver: '$REPOSERVER', gitUser: '$GITUSER', gitEmail: '$GITEMAIL' }" > installchoices.js

echo "Setup completed successfully!"


if [[ "$OS_NAME" == "CentOS Linux" ]] || [[ "$OS_NAME" == "CentOS" ]] || [[ "$OS_NAME" == "Red Hat" ]]; then
sudo dnf install redis -y
else
@@ -282,7 +279,7 @@ else
fi
sudo systemctl start redis
sudo systemctl enable redis
sudo systemctl status redis
# sudo systemctl status redis

echo "Setup completed successfully!"


+ 38
- 0
i.sqlexpress.centos.sh View File

@@ -0,0 +1,38 @@
#echo 'export PATH=$PATH:/opt/mssql-tools/bin' >> ~/.bashrc
#source ~/.bashrc

# sqlcmd -S localhost -U sa -P '<your_password>'

sudo rm /etc/yum.repos.d/mssql-server.repo

# Add Microsoft SQL Server repository
#sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/yum.repos.d/microsoft.repo
#sudo curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/mssql-server.repo
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2022.repo

sudo dnf clean all
sudo dnf makecache

# Install SQL Server Express
sudo dnf install -y mssql-server
# sudo yum install -y mssql-server

# Run the setup to configure SQL Server
sudo /opt/mssql/bin/mssql-conf setup

# Check if SQL Server is running
systemctl status mssql-server

# Enable SQL Server to start on boot
sudo systemctl enable mssql-server

# (Optional) Open SQL Server port for remote access
#sudo firewall-cmd --permanent --zone=public --add-port=1433/tcp
#sudo firewall-cmd --reload

# (Optional) Install SQL Server command-line tools
sudo dnf install -y mssql-tools

# Connect to SQL Server using sqlcmd
sqlcmd --version
#sqlcmd -S localhost -U sa -P '<your_password>'

+ 23
- 0
mysql.init.sh View File

@@ -0,0 +1,23 @@
#!/bin/bash

# Prompt the user for the MySQL root password and new password
echo "Enter MySQL root password:"
read -s ROOT_PASSWORD

# Step 6: Change authentication plugin to mysql_native_password
echo "Changing authentication plugin for MySQL root user..."
mysql -u root -p"$ROOT_PASSWORD" <<-EOF
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$ROOT_PASSWORD';
FLUSH PRIVILEGES;
EOF

# Step 8: Restart MySQL normally
echo "Restarting MySQL service..."
sudo systemctl restart mysqld

# Step 9: Test MySQL login with new password
echo "Testing MySQL login..."
mysql -u root -p"$NEW_PASSWORD" -e "SHOW DATABASES;"

echo "MySQL root user authentication plugin has been updated successfully."


Loading…
Cancel
Save