Initial commit: Kivy database interface application with search, add/update, delete functionality and Windows build support
This commit is contained in:
82
setup_database.sh
Executable file
82
setup_database.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# MariaDB Database Setup Script
|
||||
# This script helps set up the MariaDB database for the Kivy app
|
||||
|
||||
echo "MariaDB Database Setup for Kivy App"
|
||||
echo "=================================="
|
||||
echo
|
||||
|
||||
# Check if MariaDB is installed
|
||||
if ! command -v mysql &> /dev/null; then
|
||||
echo "❌ MariaDB is not installed."
|
||||
echo "Please install MariaDB first:"
|
||||
echo " sudo apt update"
|
||||
echo " sudo apt install mariadb-server"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if MariaDB service is running
|
||||
if ! systemctl is-active --quiet mariadb; then
|
||||
echo "⚠️ MariaDB service is not running."
|
||||
echo "Starting MariaDB service..."
|
||||
sudo systemctl start mariadb
|
||||
|
||||
if systemctl is-active --quiet mariadb; then
|
||||
echo "✅ MariaDB service started successfully."
|
||||
else
|
||||
echo "❌ Failed to start MariaDB service."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "✅ MariaDB service is running."
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Setting up database and user..."
|
||||
echo "You will be prompted for the MySQL root password."
|
||||
echo
|
||||
|
||||
# Create the setup SQL script
|
||||
cat > /tmp/setup_db.sql << EOF
|
||||
CREATE DATABASE IF NOT EXISTS cantare_injectie;
|
||||
CREATE USER IF NOT EXISTS 'omron'@'localhost' IDENTIFIED BY 'Initial01!';
|
||||
GRANT ALL PRIVILEGES ON cantare_injectie.* TO 'omron'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
USE cantare_injectie;
|
||||
CREATE TABLE IF NOT EXISTS offsystemsCountin (
|
||||
id VARCHAR(20) PRIMARY KEY,
|
||||
mass REAL NOT NULL
|
||||
);
|
||||
|
||||
-- Show the created database and table
|
||||
SHOW DATABASES LIKE 'cantare_injectie';
|
||||
DESCRIBE offsystemsCounting;
|
||||
EOF
|
||||
|
||||
# Execute the SQL script
|
||||
mysql -u root -p < /tmp/setup_db.sql
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo
|
||||
echo "✅ Database setup completed successfully!"
|
||||
echo
|
||||
echo "Database details:"
|
||||
echo " Host: localhost"
|
||||
echo " Database: cantare_injectie"
|
||||
echo " User: omron"
|
||||
echo " Password: Initial01!"
|
||||
echo " Table: offsystemsCounting"
|
||||
echo
|
||||
echo "You can now run the Kivy application:"
|
||||
echo " python main.py"
|
||||
echo
|
||||
else
|
||||
echo
|
||||
echo "❌ Database setup failed."
|
||||
echo "Please check the error messages above."
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
rm -f /tmp/setup_db.sql
|
||||
Reference in New Issue
Block a user